Query using field/tag existence

I was wondering if it’s possible to query documents by existence of 1+ fields (preferably tag fields). Something like this:

FT.SEARCH myIndex @tagfield1 @tagfield2 -(@tagfield3)

which is to retrieve documents that has any (non-empty) values in “tagfield1” and “tagfield2” AND does not contain any (non-empty) values in “tagfield3” field. Is this possible? Or, do I need to write my own expander?

Thanks,

Hi Daniel
I’m afraid that’s not possible directly, and writing an expander won’t help you much. An expander can only add terms that are not in the query to the query.

The only practical solution I can think of, is to add a dummy tag to all tag fields, that will never be displayed or entered by a user.

Let’s say, on all tag fields we always add the tag “_”

Then your query can look like: FT.SEARCH myIndex @tagfield1:{ _ } @tagfield2:{ _ } -@tagfield3:{ _ }