From: Sarah Hoffmann Date: Tue, 18 Mar 2025 21:55:33 +0000 (+0100) Subject: postcode token should have transliterated term in word_token X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/7b3c725f2a2752ad8165af12481d37072b4f229b?ds=inline;hp=-c postcode token should have transliterated term in word_token --- 7b3c725f2a2752ad8165af12481d37072b4f229b diff --git a/src/nominatim_api/search/icu_tokenizer.py b/src/nominatim_api/search/icu_tokenizer.py index b3e14f6a..b6cd3464 100644 --- a/src/nominatim_api/search/icu_tokenizer.py +++ b/src/nominatim_api/search/icu_tokenizer.py @@ -193,10 +193,12 @@ class ICUQueryAnalyzer(AbstractQueryAnalyzer): self.add_extra_tokens(query) for start, end, pc in self.postcode_parser.parse(query): + term = ' '.join(n.term_lookup for n in query.nodes[start + 1:end + 1]) query.add_token(qmod.TokenRange(start, end), qmod.TOKEN_POSTCODE, ICUToken(penalty=0.1, token=0, count=1, addr_count=1, - lookup_word=pc, word_token=pc, info=None)) + lookup_word=pc, word_token=term, + info=None)) self.rerank_tokens(query) log().table_dump('Word tokens', _dump_word_tokens(query))