X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/8c7140d92b7a679ae5ef5bb3655c69bd39b7dfeb..50352c634da0b44bd595a278406cd9654ce94d86:/nominatim/api/search/legacy_tokenizer.py?ds=sidebyside diff --git a/nominatim/api/search/legacy_tokenizer.py b/nominatim/api/search/legacy_tokenizer.py index e7984ee4..031f2456 100644 --- a/nominatim/api/search/legacy_tokenizer.py +++ b/nominatim/api/search/legacy_tokenizer.py @@ -44,7 +44,7 @@ class LegacyToken(qmod.Token): @property def info(self) -> Dict[str, Any]: - """ Dictionary of additional propoerties of the token. + """ Dictionary of additional properties of the token. Should only be used for debugging purposes. """ return {'category': self.category, @@ -209,7 +209,8 @@ class LegacyQueryAnalyzer(AbstractQueryAnalyzer): is_indexed = False return LegacyToken(penalty=penalty, token=row.word_id, - count=row.search_name_count or 1, + count=max(1, row.search_name_count or 1), + addr_count=1, # not supported lookup_word=lookup_word, word_token=row.word_token.strip(), category=(rowclass, row.type) if rowclass is not None else None, @@ -226,7 +227,7 @@ class LegacyQueryAnalyzer(AbstractQueryAnalyzer): if len(part) <= 4 and part.isdigit()\ and not node.has_tokens(i+1, qmod.TokenType.HOUSENUMBER): query.add_token(qmod.TokenRange(i, i+1), qmod.TokenType.HOUSENUMBER, - LegacyToken(penalty=0.5, token=0, count=1, + LegacyToken(penalty=0.5, token=0, count=1, addr_count=1, lookup_word=part, word_token=part, category=None, country=None, operator=None, is_indexed=True))