Closed maccman closed 1 year ago
Hi @maccman , MiniSearch uses a “bag of words” approach, so it won’t consider word order or proximity. This is a trade-off in order to support a compact index that can comfortably fit in memory.
That said, one possible way to achieve what you want is to use MiniSearch like you described to narrow down candidate results, then scan those results with the String.prototype.includes
JS method to keep only those results where the whole phrase appears as-is.
Ah smart! Great - I will do that.
What is best practices when it comes to exact match searches? To be specific, we support surrounding search queries with quotes and then we turn off prefix and fuzzy matching.
However, MiniSearch will still tokenize the query and so it will search for every token in our query and while we are using
AND
, the terms won't necessarily be searched in order.If we wanted to support only return results that have an exact string, what do you suggest we do there?