3

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.

peterschrott
  • 570
  • 5
  • 25
  • Did you get an answer to your query @peterschrott? I am starting up with atlas search and need to know this as well. – Avani Khabiya Oct 06 '20 at 06:22
  • @AvaniKhabiya, unfortunately not. Atm I am just not using fuzzy search, which is not great but works. I would love to use it. Maybe there is a fix by now? Feel free to keep me updated on that issue. – peterschrott Oct 07 '20 at 09:42

0 Answers0