redisredisjsonredis-search

Why is RedisSearch missing documents in results when querying with a prefix on a tag field?


In Redis, I have a full-text index on JSON documents with a field called lemma_exact. It is tied to an array of strings on the underlying JSON document.

I can find a certain article using the index with the following query:

(@lemma_exact:{viking})

This returns the article I am looking for. However, if I use this query:

(@lemma_exact:{*ing})

I get articles where the indexed field contains a value that ends in -ing. This is what I want. However, it does not include all articles — notably, as in this example, not the one where the field is "viking".

What may be going wrong here?

Things I've already checked:


Solution

  • Timeout was my first thought here too, so you're thinking about it correctly. You could always set the ON_TIMEOUT behavior to FAIL to confirm that the timeout isn't being hit. But 10 seconds is forever in Redis terms, so I doubt that it will be.

    However, it might be worth playing with the MAXPREFIXEXPANSIONS setting. Increasing it is a performance tradeoff, but I've seen these sorts of issues before when a prefix or suffix is particularly common. And -ing is certainly common.