Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 583
Dmytro Chasovskyi Avatar asked Oct 24 '25 03:10

Dmytro Chasovskyi


1 Answers

You should be able to get away with something like:

FT.SEARCH permits "@tags:{DE|EN} -@tags:{NO|EE}"
like image 170
Itamar Haber Avatar answered Oct 26 '25 03:10

Itamar Haber