]> git.openstreetmap.org Git - nominatim.git/commitdiff
protect against very frequent bad partials
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 27 Jan 2024 20:26:03 +0000 (21:26 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 28 Jan 2024 18:03:11 +0000 (19:03 +0100)
nominatim/api/search/db_search_builder.py

index 6d5fa41a9c9dd9e1c450d9b5201f64c851df1c34..94c492c22be8c612f6e49379acde60419e8f9cef 100644 (file)
@@ -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.