Reputation: 21
I'm looking for the Redisearch equivalent of the following query:
NOT (topic_id = '123' AND post_id <= '456')
I tried the following - it works but doesn't look like the most elegant solution:
-(@topic_id:[123 123] @post_id:[-inf 456])
topic_id
and post_id
are NUMERIC and SORTABLE
Thanks for your help!
Upvotes: 2
Views: 428
Reputation: 1705
Chris, Your query looks perfectly valid, the only simplification I would apply is:
-(@topic_id:123 @post_id:[-inf 456])
To avoid repeating the 123
value. The other option would be to use DeMorgan's law and rewrite your NOT(A AND B)
to (!A OR !B)
but I don't think that would buy you anything, and in this case it would make it harder to read I think.
Upvotes: 3