magento / magento/community-features
Allow 'contains' as a search criteria condition type
Nobody has claimed this yet.
- 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
- Magento 2.2.1
Steps to reproduce
- Install Magento 2.2.1
- Install sample data using
bin/magento sampledata:deploy - Deactivate WebApi security settings in Admin > Store > Configuration > Services > Magento WebAPI
- 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
- Response xml contains products with 'red' in their sku.
Actual result
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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