From 3865165e4e91cafdfbc7d1001d52a96aa607b91c Mon Sep 17 00:00:00 2001 From: akmiller01 Date: Fri, 4 Aug 2023 13:31:57 -0400 Subject: [PATCH] Replace edge ngram tokenizer with ngram to prevent partial matches --- di_website/settings/base.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/di_website/settings/base.py b/di_website/settings/base.py index 88c6f1b01..6467ad57b 100644 --- a/di_website/settings/base.py +++ b/di_website/settings/base.py @@ -166,12 +166,6 @@ if config('ELASTIC_SEARCH_URL', ''): - elastic_search_tokens = [ - 'letter', - 'digit', - 'symbol', - ] - WAGTAILSEARCH_BACKENDS = { 'default': { 'BACKEND': 'wagtail.search.backends.elasticsearch7', @@ -184,7 +178,7 @@ 'analysis': { 'analyzer': { "default": { - "tokenizer": "edgengram_tokenizer", + "tokenizer": "standard_tokenizer", "filter": [ "stop_filter", "lowercase_filter" ] } }, @@ -198,11 +192,8 @@ } }, 'tokenizer': { - 'edgengram_tokenizer': { - 'type': 'edge_ngram', - 'min_gram': 3, - 'max_gram': 10, - 'token_chars': elastic_search_tokens + 'standard_tokenizer': { + 'type': 'standard' } }, },