Open Kvit opened 4 years ago
You could solve it?
I could not find a way
I found a way to make artificial weigths, using the $cond, the problem is that the word need to match identically. If exists someway to use a sensible case it will be better, less restricted. Do you know a way?
cars$aggregate('[
{ "$match": {
"$text": { "$search": "ford" }
}},
{ "$project": {
"Company": 1, "Model" : 1, "Category" : 1, "_id" : 0,
"score": {
"$add": [
{ "$meta": "textScore" },
{ "$cond": [ { "$eq": [ "$Company", "Ford" ] }, 10, 0]}
]
}
}},
{ "$sort": { "score": -1 } }
]')
MongoDB command for creating an index with weights includes two parts one with field names , another with weights.
How can such index be created via mongolite? The problem is that I cannot find a way to coerce both parts of the command to acceptable valid json object to pass into db$index(add='') method. Any thoughts?