Search code examples
syntaxincluderedisearch

How to write a query to both include and exclude tags in RediSearch?


I want to include and exclude a set of tags in RediSearch queries. How can I do it?

The query below is what I am trying to do:

FT.SEARCH permits "@tags:{DE | EN | -(NO | EE)}"

It gives an error: (error) Syntax error at offset 17 near 'EN'

What would be the syntax to include and exclude tags in RediSearch?


Solution

  • You should be able to get away with something like:

    FT.SEARCH permits "@tags:{DE|EN} -@tags:{NO|EE}"