2

In the application we are implementing a search function using rest api. The search will happen using multiple filters. By default, magento is using "and" operator between filters for producing search results.

However our requirement is to use "or" operator between filter so that result matching with any of the filter will show up.

We have one more requirement where we need to display the result matching with first filter on top and then the result matching with second filter

kindly guide us how we can achieve this.

1

This page will describe how to use the different searchcriteras: http://devdocs.magento.com/guides/v2.1/howdoi/webapi/search-criteria.html

rest/V1/products?
searchCriteria[filter_groups][0][filters][0][field]=name&
searchCriteria[filter_groups][0][filters][0][value]=%25Leggings%25&
searchCriteria[filter_groups][0][filters][0][condition_type]=or&
searchCriteria[filter_groups][0][filters][1][field]=name&
searchCriteria[filter_groups][0][filters][1][value]=%25Top%25&
searchCriteria[filter_groups][0][filters][1][condition_type]=or
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.