From: Sarah Hoffmann Date: Sun, 28 Jan 2024 10:48:03 +0000 (+0100) Subject: always add a penalty for name + address search fallback X-Git-Tag: v4.4.0~23^2~2 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/f9ba7a465a8192f89b4150a43b247d8dd29087cd?ds=sidebyside;hp=--cc always add a penalty for name + address search fallback If there already was a search by full names, the search is likely a repeatition that yields the same results, only running slower. --- f9ba7a465a8192f89b4150a43b247d8dd29087cd diff --git a/nominatim/api/search/db_search_builder.py b/nominatim/api/search/db_search_builder.py index 94c492c2..62b4e1b5 100644 --- a/nominatim/api/search/db_search_builder.py +++ b/nominatim/api/search/db_search_builder.py @@ -243,7 +243,8 @@ class SearchBuilder: lookup = [dbf.FieldLookup('name_vector', list(name_partials.keys()), lookups.LookupAll)] if addr_tokens: lookup.append(dbf.FieldLookup('nameaddress_vector', addr_tokens, lookups.LookupAll)) - penalty += 0.35 * max(0, 5 - len(name_partials) - len(addr_tokens)) + penalty += 0.35 * max(1 if name_fulls else 0.1, + 5 - len(name_partials) - len(addr_tokens)) yield penalty, exp_count, lookup