From: Sarah Hoffmann Date: Sat, 27 Jan 2024 20:26:03 +0000 (+0100) Subject: protect against very frequent bad partials X-Git-Tag: v4.4.0~23^2~4 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/2703442fd2b470a986db0b8b4fbe3f3e6905dcb2?ds=inline protect against very frequent bad partials --- diff --git a/nominatim/api/search/db_search_builder.py b/nominatim/api/search/db_search_builder.py index 6d5fa41a..94c492c2 100644 --- a/nominatim/api/search/db_search_builder.py +++ b/nominatim/api/search/db_search_builder.py @@ -233,7 +233,8 @@ class SearchBuilder: # Any of the full names applies with all of the partials from the address yield penalty, fulls_count / (2**len(addr_tokens)),\ dbf.lookup_by_any_name([t.token for t in name_fulls], - addr_tokens, fulls_count > 10000) + addr_tokens, + fulls_count > 30000 / max(1, len(addr_tokens))) # To catch remaining results, lookup by name and address # We only do this if there is a reasonable number of results expected.