From 8b56b55761d0dcc817544f9c23e4a6c43e0f5d9d Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 6 Sep 2023 10:43:55 +0200 Subject: [PATCH] restrict deduplication to results from placex All other sources do not have deduplicatable entries. --- nominatim/api/v1/helpers.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/nominatim/api/v1/helpers.py b/nominatim/api/v1/helpers.py index 6a646e4f..13087280 100644 --- a/nominatim/api/v1/helpers.py +++ b/nominatim/api/v1/helpers.py @@ -108,15 +108,18 @@ def deduplicate_results(results: SearchResults, max_results: int) -> SearchResul assert result.names and 'ref' in result.names if any(_is_postcode_relation_for(r, result.names['ref']) for r in results): continue - classification = (result.osm_object[0] if result.osm_object else None, - result.category, - result.display_name, - result.rank_address) - if result.osm_object not in osm_ids_done \ - and classification not in classification_done: + if result.source_table == SourceTable.PLACEX: + classification = (result.osm_object[0] if result.osm_object else None, + result.category, + result.display_name, + result.rank_address) + if result.osm_object not in osm_ids_done \ + and classification not in classification_done: + deduped.append(result) + osm_ids_done.add(result.osm_object) + classification_done.add(classification) + else: deduped.append(result) - osm_ids_done.add(result.osm_object) - classification_done.add(classification) if len(deduped) >= max_results: break -- 2.45.1