From cfa912102c58e584e78065f8e33ee0db6846404c Mon Sep 17 00:00:00 2001
From: Edward Betts <edward@4angle.com>
Date: Sun, 14 Nov 2021 09:47:55 +0000
Subject: [PATCH] Add name_match to nearby OSM candidates API call.

---
 matcher/api.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/matcher/api.py b/matcher/api.py
index ab1d200..2cc34da 100644
--- a/matcher/api.py
+++ b/matcher/api.py
@@ -605,6 +605,7 @@ def find_osm_candidates(item, limit=80, max_distance=450, names=None):
     item_id = item.item_id
     item_is_linear_feature = item.is_linear_feature()
     item_is_street = item.is_street()
+    item_names = {n.lower() for n in item.names().keys()}
 
     check_is_street_number_first(item.locations[0].get_lat_lon())
 
@@ -707,6 +708,7 @@ def find_osm_candidates(item, limit=80, max_distance=450, names=None):
             "id": osm_id,
             "distance": distance,
             "name": name,
+            "name_match": (name.lower() in item_names),
             "tags": tags,
             "geojson": json.loads(geojson),
             "presets": get_presets_from_tags(shape, tags),