magento / magento/community-features

Allow 'contains' as a search criteria condition type

Open
#12 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

moved from magento2 Priority: P3
Dominant language
No language data
Stars
46
Forks
14
PR merge metrics
No merged PRs in 30d

Description

As an API consumer, I don't want to have to think about formatting 'like' conditions for my search criteria, and would like to be able to use a 'contains' search criteria condition type.

Preconditions
  1. Magento 2.2.1
Steps to reproduce
  1. Install Magento 2.2.1
  2. Install sample data using bin/magento sampledata:deploy
  3. Deactivate WebApi security settings in Admin > Store > Configuration > Services > Magento WebAPI
  4. Send request to http://[magento host]/rest/V1/products?searchCriteria[filter_groups][0][filters][0][field]=sku&searchCriteria[filter_groups][0][filters][0][value]=red&searchCriteria[filter_groups][0][filters][0][condition_type]=contains
Expected result
  1. Response xml contains products with 'red' in their sku.
Actual result
  1. No products returned.

Original Report: https://github.com/magento/magento2/issues/12458 by @nbennett25

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the request against the REST V1/products endpoint using the sample data and the provided searchCriteria parameters. Trace how filter condition types are handled and verify completion when a contains condition returns products whose SKU includes the supplied value.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.