]> git.openstreetmap.org Git - nominatim.git/commitdiff
NearSearch needs to inherit penalty from inner search
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 28 Nov 2023 19:12:12 +0000 (20:12 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 29 Nov 2023 10:28:52 +0000 (11:28 +0100)
nominatim/api/search/db_search_builder.py

index f89d8b62e827178928bcc3c8d7fd210a30ef00a8..6d94feaba84343eac42e44166931b54c5eaf4d80 100644 (file)
@@ -113,7 +113,10 @@ class SearchBuilder:
             penalty = min(near_items.penalties)
             near_items.penalties = [p - penalty for p in near_items.penalties]
             for search in builder:
-                yield dbs.NearSearch(penalty + assignment.penalty, near_items, search)
+                search_penalty = search.penalty
+                search.penalty = 0.0
+                yield dbs.NearSearch(penalty + assignment.penalty + search_penalty,
+                                     near_items, search)
         else:
             for search in builder:
                 search.penalty += assignment.penalty