I am working with the current version of MongoDB Atlas Search (version 4.2.8) hosted cloud.mongodb.com.
My search index is defined as followed:
{
mappings: {
dynamic: false,
fields: {
name: {
type: "autocomplete"
}
}
}
}
And I am running the following query:
db.getCollection("test").aggregate([
{
$search: {
autocomplete: {
query: "Wassar",
path: "name",
fuzzy: { maxEdits: 2 }
}
}
}, {
$project: {
name: "$name",
score: { $meta: "searchScore" }
}
}
])
On the result the score is a 1.0
for ALL documents in the result set:
{
"_id" : ObjectId("..."),
"name" : "Wasser",
"score" : 1.0
}
Is this the expected behaviour using fuzzy on autocomplete or am I missing something?
Working with type type: "string"
and analyzer: "lucene.standard"
in the search index definition and a simple text query, the scoring works as expected.
Sidenote: I expected the fuzzy parameter to be set to the default values as described in the docs but it has to be set manually.