My objective is to implement an effect user-name search aggregation with Mongodb Atlas full text search. It's not going super well. Currently I struggle to understand, why the following does not result in a score of 1?
data
[{name: "John Doe"}, {"John Eriksen", {"Lara Croft"} ]
Search Index
{ "mappings": { "dynamic": true } }
Pipeline
[
{
'$search': {
'text': {
'query': 'John Doe',
'path': 'name'
}
}
}, {
'$addFields': {
'score': {
'$meta': 'searchScore'
}
}
}
]
Result
John Doe → 0.66
John Eriksen" → 0.21
Why does "John Doe" not return a score of 1, it's an exact score after all?