Answer the question
In order to leave comments, you need to log in
MongoDB text search and correct textScore?
There is a collection (with a text index) that looks something like this:
[{id: 1, "items" : [ "milk", "bread", "fish" ]},
{id: 2, "items" : [ "milk", "milk", "milk" ]},
{id: 3, "items" : [ "cheese", "salt" ]},
{id: 4, "items" : [ "fish", "bread"]}]
coll.find({$text:{"$search": "milk bread fish"}}, {score:{$meta:"textScore"}}).sort({score:{$meta:"textScore"}})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question