简体   繁体   中英

Doing AND queries with ReactiveSearch

Is it possible to do AND queries with Reactivesearch? It seems that if you select multiple criteria in a multidatalist, it will return records that match any one of the criteria you selected. I want to modify the search such that if I select multiple criteria, then only those records are returned that match all the criteria that I selected.

For example, if some movies are tagged as both thriller and drama and others are tagged as either drama only or thriller only and I select both thriller and drama, then only those movies should be returned that are tagged as both thriller and drama. Movies that are tagged as only drama or only thriller should not be returned.

Yes, you can do AND queries with ReactiveSearch. For the above use case, you can use customQuery prop with MultiDataList component. Here you can specify a callback function that can build a query with must clauses between the same fields.

Have created code sandbox to demonstrate the above use case. https://codesandbox.io/s/multidatalist-khsup

For more reference, you can docs https://docs.appbase.io/docs/reactivesearch/v3/list/multidatalist/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM