X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/6e89310a9285f1ad15d8002bf68f578eada367a0..f535340d5af0b59c1bbdfde885b62dd483a9e38e:/src/nominatim_api/search/legacy_tokenizer.py diff --git a/src/nominatim_api/search/legacy_tokenizer.py b/src/nominatim_api/search/legacy_tokenizer.py index b49d3ae6..c7b10119 100644 --- a/src/nominatim_api/search/legacy_tokenizer.py +++ b/src/nominatim_api/search/legacy_tokenizer.py @@ -14,7 +14,7 @@ import dataclasses import sqlalchemy as sa -from nominatim_core.typing import SaRow +from ..typing import SaRow from ..connection import SearchConnection from ..logging import log from . import query as qmod @@ -193,7 +193,7 @@ class LegacyQueryAnalyzer(AbstractQueryAnalyzer): lookup_word = row.word_token[1:] elif rowclass == 'place' and row.type == 'postcode': ttype = qmod.TokenType.POSTCODE - lookup_word = row.word_token[1:] + lookup_word = row.word else: ttype = qmod.TokenType.NEAR_ITEM if row.operator in ('in', 'near')\ else qmod.TokenType.QUALIFIER @@ -253,13 +253,14 @@ class LegacyQueryAnalyzer(AbstractQueryAnalyzer): def _dump_word_tokens(query: qmod.QueryStruct) -> Iterator[List[Any]]: - yield ['type', 'token', 'word_token', 'lookup_word', 'penalty', 'count', 'info'] + yield ['type', 'token', 'word_token', 'lookup_word', 'penalty', 'count', 'info', 'indexed'] for node in query.nodes: for tlist in node.starting: for token in tlist.tokens: t = cast(LegacyToken, token) yield [tlist.ttype.name, t.token, t.word_token or '', - t.lookup_word or '', t.penalty, t.count, t.info] + t.lookup_word or '', t.penalty, t.count, t.info, + 'Y' if t.is_indexed else 'N'] async def create_query_analyzer(conn: SearchConnection) -> AbstractQueryAnalyzer: