X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/a7f5c6c8f54eea4e3d9746141b2e0ac2d5722a4a..38798bba13d1257936e960517e0c9d16aee05cff:/nominatim/api/search/query.py diff --git a/nominatim/api/search/query.py b/nominatim/api/search/query.py index 4bf009a5..a0d7add1 100644 --- a/nominatim/api/search/query.py +++ b/nominatim/api/search/query.py @@ -46,7 +46,7 @@ class TokenType(enum.Enum): """ Country name or reference. """ QUALIFIER = enum.auto() """ Special term used together with name (e.g. _Hotel_ Bellevue). """ - CATEGORY = enum.auto() + NEAR_ITEM = enum.auto() """ Special term used as searchable object(e.g. supermarket in ...). """ @@ -78,7 +78,7 @@ class PhraseType(enum.Enum): return not is_full_phrase or ttype != TokenType.QUALIFIER if self == PhraseType.AMENITY: return ttype in (TokenType.WORD, TokenType.PARTIAL)\ - or (is_full_phrase and ttype == TokenType.CATEGORY)\ + or (is_full_phrase and ttype == TokenType.NEAR_ITEM)\ or (not is_full_phrase and ttype == TokenType.QUALIFIER) if self == PhraseType.STREET: return ttype in (TokenType.WORD, TokenType.PARTIAL, TokenType.HOUSENUMBER) @@ -99,6 +99,7 @@ class Token(ABC): penalty: float token: int count: int + addr_count: int lookup_word: str is_indexed: bool @@ -169,7 +170,7 @@ class TokenList: @dataclasses.dataclass class QueryNode: - """ A node of the querry representing a break between terms. + """ A node of the query representing a break between terms. """ btype: BreakType ptype: PhraseType