Hi,
I am currently trying to integrate EasySearch package in my app using the MongoDB
searcher. The question is actually well explained here. I am wondering if there can be any way of sorting the regex search result with relevance / number of matches.
For example,
Consider the following values of a field Title
:
Toyota
Toyota Camry
BMW
Toyota Corolla
Mercedes
And if I search for the term "Toyota Camry"
The regex search returns all 3 Toyota records because they all match one of the tokens (Toyota
) with no preference to Toyota Camry
.
I do not intend to use $text
$search
because I also need a $near
filter with this query which is not allowed (according to the docs)
I am aware that this can be done with ElasticSearch
but is this not possible with MongoDB? ElasticSearch has a lot more overhead and I do not have much experience with it and I think I will have to replicate (river?) the MongoDB.