M Kravets
M Kravets

Reputation: 61

Search Atlas autocomplite return not matched data

I have a question about Atlas search autocomplete. My index look like

"wholeName": [
        {
          "type": "string"
        },
        {
          "foldDiacritics": false,
          "maxGrams": 7,
          "minGrams": 3,
          "tokenization": "edgeGram",
          "type": "autocomplete"
        }
      ]

my query look like:

{
    "$search": {
        "index": "free-text",
        "autocomplete": {
            "path": "wholeName",
            "query": "Ramiro Fargo",
            "fuzzy": {},
        },
    },
},

And If I want to find a Ramiro Fargo, I also get Ramiro Firgo, Ramiro Faster, Ramiro Furso But I want to see full match, or part if I pass Ramiro Thanks for helping

Read a lot of questions, tried to do it with different autocomplete types

Upvotes: 0

Views: 310

Answers (1)

elle
elle

Reputation: 46

"fuzzy": {} is the reason that you are seeing results with variations on what you queried. If you remove the fuzzy parameter it should be more of an exact match.

If you're looking for exact match examples, check this tutorial on MongoDB's website.

Ah or if you're trying to boost the exact match try this example.

Upvotes: 0

Related Questions