2 / 3
Mar 31

I am performing a full-text search with fuzzy: {} on one field in a collection that has 1million + documents. I need to find matching words that may slightly vary.

Since the $search stage must be the first stage, I can only filter fields after retrieving results, leading to high latency.

I would prefer to use the $compound stage with filter and should, as it has been much faster than full-text fuzzy search. However, the should clause does not rank results the way I need.
Specifically, I require the lucene.simple analyzer with fuzzy search for correct matching.

Does anyone know how I can:

Filter the data I use the full text search on before the search
Or
Adjust the logic of the should clause in the $compound stage to score results similarly to lucene.simple with fuzzy search?

Any advice would be so appreciated, thank you.

Lily -

Here’s a Search Playground that seems to handle what you’re asking, roughly: Code Sandbox

In there it is filtering by a field (which is mapped as a token type explicitly) and fuzzy searching as well.

Hey thank you so much Erik, this was really helpful. I didn’t realize these two set ups would yield similar results.