X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/6e89310a9285f1ad15d8002bf68f578eada367a0..3cc20581aeac2c263fe1e9f6d4c8ab3e428bea00:/src/nominatim_api/search/db_search_builder.py diff --git a/src/nominatim_api/search/db_search_builder.py b/src/nominatim_api/search/db_search_builder.py index 29a853a0..6453509e 100644 --- a/src/nominatim_api/search/db_search_builder.py +++ b/src/nominatim_api/search/db_search_builder.py @@ -167,7 +167,12 @@ class SearchBuilder: expected_count = sum(t.count for t in hnrs) partials = {t.token: t.addr_count for trange in address - for t in self.query.get_partials_list(trange)} + for t in self.query.get_partials_list(trange) + if t.is_indexed} + + if not partials: + # can happen when none of the partials is indexed + return if expected_count < 8000: sdata.lookups.append(dbf.FieldLookup('nameaddress_vector', @@ -275,7 +280,7 @@ class SearchBuilder: use_lookup: bool) -> List[dbf.FieldLookup]: """ Create a ranking expression with full name terms and additional address lookup. When 'use_lookup' is true, then - address lookups will use the index, when the occurences are not + address lookups will use the index, when the occurrences are not too many. """ # At this point drop unindexed partials from the address.