From b7a1a2b73e903c4da57970926844b0639dce5aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com> Date: Sun, 11 Nov 2018 23:07:24 +0100 Subject: [PATCH] Put Elasticsearch index settings into settings --- openlobby/settings.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/openlobby/settings.py b/openlobby/settings.py index ff9786d..8e6a44a 100644 --- a/openlobby/settings.py +++ b/openlobby/settings.py @@ -86,7 +86,34 @@ ELASTICSEARCH_DSL = { "default": {"hosts": os.environ.get("ELASTICSEARCH_DSN", "http://localhost:9200")} } -ELASTICSEARCH_DSL_INDEX_SETTINGS = {"number_of_shards": 1, "number_of_replicas": 0} +ELASTICSEARCH_DSL_INDEX_SETTINGS = { + "number_of_shards": 1, + "number_of_replicas": 0, + "analysis": { + "filter": { + "czech_stop": {"type": "stop", "stopwords": "_czech_"}, + "czech_stemmer": {"type": "stemmer", "language": "czech"}, + "cs_CZ": {"type": "hunspell", "locale": "cs_CZ", "dedup": True}, + "czech_synonym": { + "type": "synonym", + "synonyms_path": "analysis/cs_CZ/synonym.txt", + }, + }, + "analyzer": { + "czech": { + "tokenizer": "standard", + "filter": [ + "icu_folding", + "lowercase", + "czech_synonym", + "czech_stop", + "czech_stemmer", + "cs_CZ", + ], + } + }, + }, +} # Password validation -- GitLab