Using Exclusion in the Filter_by Function
TLDR Ricardo needed help with exclusion in the filter_by function. Kishore Nallan explained how to do this, then provided the source code url for further clarification.
Jun 15, 2021 (29 months ago)
Ricardo
06:05 AMfield:=value
can I do something like field:!=value
?Kishore Nallan
06:06 AMCurrently supporting the exclusion operator (-) on only string facets. Usage:
filter_by=author:- JK Rowling (excludes a single value)
filter_by=author:- [JK Rowling, Enid Blyton]
(excludes both authors)
If you want to include some and exclude others you can have two filter_by clauses separated by && e.g.
filter_by=author:- [JK Rowling, Enid Blyton] && author: [JRR Tolkien, John Grisham, George Martin]
Ricardo
06:08 AMKishore Nallan
06:26 AMRicardo
06:33 AMTypesense
Indexed 2776 threads (79% resolved)
Similar Threads
Implementation and Testing of Negative Filtering on Typesense
Stefan needed an ETA on implementing negative filtering on layer of `typesense`. Kishore Nallan provided updates, fixes, and an early build for testing. Further plans on adding it to instantsearch adapter were discussed, with Stefan also offering to contribute.
Discussing Filter Operators in Typesense
Roshan asked about the functionality of the 'contains' operator in Typesense filters. Kishore Nallan explained how to use the operator and suggested using a curl query for better insight into the issue. However, the thread ends without a resolution.
Trouble with 'q' Parameter in Typesense query
ryosuke_shiomi was having trouble with a Typesense query involving the 'q' parameter. Kishore Nallan suggested a temporary workaround and proposed using the latest builds to fix the issue. The solution was under trial at the end of the thread.