X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/a413aae8a3962be4d623844d867604df68a9a211..6c4c9ec1f2fb2ae2026f3cd59c505dd33c4ebe3e:/nominatim/api/search/db_search_builder.py diff --git a/nominatim/api/search/db_search_builder.py b/nominatim/api/search/db_search_builder.py index b6ba211c..9ff8c03c 100644 --- a/nominatim/api/search/db_search_builder.py +++ b/nominatim/api/search/db_search_builder.py @@ -141,12 +141,14 @@ class SearchBuilder: yield dbs.CountrySearch(sdata) if sdata.postcodes and (is_category or self.configured_for_postcode): + penalty = 0.0 if sdata.countries else 0.1 if address: sdata.lookups = [dbf.FieldLookup('nameaddress_vector', [t.token for r in address for t in self.query.get_partials_list(r)], 'restrict')] - yield dbs.PostcodeSearch(0.4, sdata) + penalty += 0.2 + yield dbs.PostcodeSearch(penalty, sdata) def build_housenumber_search(self, sdata: dbf.SearchData, hnrs: List[Token],