Add option to use $all filter instead of $text search
Do you want to request a feature, an issue, or report a bug? feature
What is the current behaviour? Current behavior is to use $text query to search the collection. This gives inaccurate results because of lots of partial matches when searching multiple small common phrases. Eg. when searching "prime bank" it is currently giving results which have only one of these at the top instead of the document which has both.
If the current behaviour is a bug, please provide the steps to reproduce.
What is the expected behaviour?
An option where only results are returned which contain all phrases searched. I was thinking how to do this, and instead of using $text search if I instead search the fuzzy array with {$all :
If this is a feature request, what is the motivation or use case for changing the behaviour? Limiting results when larger search query.
Please mention other relevant information such as Node.js and mongoose version. Node: 14 Mongoose: 5.10
This isn't completely fleshed out, I will try to create a reproduction repo.
@rohit-gohri try this https://github.com/evgeniy-skakun/mongoose-fuzzy-searching, there is a search for specific fields using $all
User.fuzzySearch({ query: 'jo', prefixOnly: true, fields: ['firstName'] })
.then(console.log)
.catch(console.error);