X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/3c7a28dab0e7fa9b1d9eb4a5f9bdddfb879d0384..fed46240d5af3a2543e7cac930a862d6a0abde7b:/nominatim/api/search/geocoder.py?ds=inline diff --git a/nominatim/api/search/geocoder.py b/nominatim/api/search/geocoder.py index bb3c6a1c..27e4d91e 100644 --- a/nominatim/api/search/geocoder.py +++ b/nominatim/api/search/geocoder.py @@ -64,7 +64,7 @@ class ForwardGeocoder: log().table_dump('Searches for assignment', _dump_searches(searches, query, num_searches)) num_searches = len(searches) - searches.sort(key=lambda s: s.penalty) + searches.sort(key=lambda s: (s.penalty, s.SEARCH_PRIO)) return query, searches @@ -85,6 +85,7 @@ class ForwardGeocoder: if search.penalty > prev_penalty and (search.penalty > min_ranking or i > 20): break log().table_dump(f"{i + 1}. Search", _dump_searches([search], query)) + log().var_dump('Params', self.params) lookup_results = await search.lookup(self.conn, self.params) for result in lookup_results: rhash = (result.source_table, result.place_id, @@ -140,7 +141,8 @@ class ForwardGeocoder: or (result.importance is not None and result.importance < 0): continue distance = 0.0 - norm = self.query_analyzer.normalize_text(result.display_name) + norm = self.query_analyzer.normalize_text(' '.join((result.display_name, + result.country_code or ''))) words = set((w for w in norm.split(' ') if w)) if not words: continue