#community-help

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.

Powered by Struct AI
5
29mo
Solved
Join the chat
Jun 15, 2021 (29 months ago)
Ricardo
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Ricardo
06:05 AM
Is there a way to an exclusion in the filter_by ? right now I can do field:=value can I do something like field:!=value ?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:06 AM
Available in RC build.

Currently 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
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Ricardo
06:08 AM
Kishore Nallan awesome. thanks! Do you mind also pointing to me the source for this? the cpp file.
Ricardo
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Ricardo
06:33 AM
thanks 🙂