From: Sarah Hoffmann Date: Wed, 17 Jan 2024 09:48:11 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: deploy~23 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/1260b0c95d0551a1677219f48a0651390e6357d4?hp=-c Merge remote-tracking branch 'upstream/master' --- 1260b0c95d0551a1677219f48a0651390e6357d4 diff --combined nominatim/api/search/icu_tokenizer.py index 6f3e09e8,1c2565d1..76a1a2e5 --- a/nominatim/api/search/icu_tokenizer.py +++ b/nominatim/api/search/icu_tokenizer.py @@@ -186,7 -186,10 +186,10 @@@ class ICUQueryAnalyzer(AbstractQueryAna if trange.start == 0: query.add_token(trange, qmod.TokenType.NEAR_ITEM, token) else: - query.add_token(trange, qmod.TokenType.QUALIFIER, token) + if trange.start == 0 and trange.end == query.num_token_slots(): + query.add_token(trange, qmod.TokenType.NEAR_ITEM, token) + else: + query.add_token(trange, qmod.TokenType.QUALIFIER, token) else: query.add_token(trange, DB_TO_TOKEN_TYPE[row.type], token) @@@ -203,12 -206,7 +206,12 @@@ standardized form search will work with. All information removed at this stage is inevitably lost. """ - return cast(str, self.normalizer.transliterate(text)) + norm = cast(str, self.normalizer.transliterate(text)) + numspaces = norm.count(' ') + if numspaces > 4 and len(norm) <= (numspaces + 1) * 3: + return '' + + return norm def split_query(self, query: qmod.QueryStruct) -> Tuple[QueryParts, WordDict]: