Danish stopwords in autocomplete index

Hi

I have a autocomplete index on a title field, and it works fine.
But i realize that it shoud be optimized to not return results that are hitting danish stopwords eg. ‘og’ (danish for and.
How is it possible to exclude stopwords in a autocomplete search index ?

Hi @Preben_Asmussen Welcome to the MongoDB Developer Forum!

You raise a good point because it is not possible to specify a language analyzer for autocomplete. Today, that will change. If you check back on this page, we will release the ability to specify a language analyzer.

1 Like

Nice. Any eta on this feature ?

@Preben_Asmussen You’re in luck. We released this feature today. :slight_smile: I hope this is helpful.

from the example in the docs, you might do something like:

{
  "mappings": {
    "dynamic": true|false,
    "fields": {
      "<field-name>": [
        {
          "type": "autocomplete",
          "analyzer": "lucene.danish",
          "tokenization": "edgeGram|rightEdgeGram|nGram",
          "minGrams": <2>,
          "maxGrams": <15>,
          "foldDiacritics": true|false
        }
      ]
    }
  }
}
1 Like

wow thats awesome. :slight_smile:

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.