mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-12 05:44:06 +00:00
restrict deduplication to results from placex
All other sources do not have deduplicatable entries.
This commit is contained in:
@@ -108,15 +108,18 @@ def deduplicate_results(results: SearchResults, max_results: int) -> SearchResul
|
|||||||
assert result.names and 'ref' in result.names
|
assert result.names and 'ref' in result.names
|
||||||
if any(_is_postcode_relation_for(r, result.names['ref']) for r in results):
|
if any(_is_postcode_relation_for(r, result.names['ref']) for r in results):
|
||||||
continue
|
continue
|
||||||
classification = (result.osm_object[0] if result.osm_object else None,
|
if result.source_table == SourceTable.PLACEX:
|
||||||
result.category,
|
classification = (result.osm_object[0] if result.osm_object else None,
|
||||||
result.display_name,
|
result.category,
|
||||||
result.rank_address)
|
result.display_name,
|
||||||
if result.osm_object not in osm_ids_done \
|
result.rank_address)
|
||||||
and classification not in classification_done:
|
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)
|
deduped.append(result)
|
||||||
osm_ids_done.add(result.osm_object)
|
|
||||||
classification_done.add(classification)
|
|
||||||
if len(deduped) >= max_results:
|
if len(deduped) >= max_results:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user