From ca45db0ed63dc333692d31c1155fe23d87ff0ed5 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 25 Jul 2016 20:20:01 +0200 Subject: [PATCH] Improve address similarity --- OsmAnd-java/src/net/osmand/search/SearchUICore.java | 5 ++++- OsmAnd-java/src/net/osmand/search/core/ObjectType.java | 4 ++++ OsmAnd-java/src/net/osmand/search/core/SearchResult.java | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/search/SearchUICore.java b/OsmAnd-java/src/net/osmand/search/SearchUICore.java index 3507f78019..73dfe294d0 100644 --- a/OsmAnd-java/src/net/osmand/search/SearchUICore.java +++ b/OsmAnd-java/src/net/osmand/search/SearchUICore.java @@ -246,13 +246,16 @@ public class SearchUICore { a2 = (Amenity) r2.object; } if (r1.localeName.equals(r2.localeName)) { - double similarityRadius = 20; + double similarityRadius = 30; if(a1 != null && a2 != null) { if(a1.getType().getKeyName().equals("natural") && a2.getType().getKeyName().equals("natural")) { similarityRadius = 10000; } } + if(ObjectType.isAddress(r1.objectType) && ObjectType.isAddress(r2.objectType)) { + similarityRadius = 100; + } return MapUtils.getDistance(r1.location, r2.location) < similarityRadius; } } diff --git a/OsmAnd-java/src/net/osmand/search/core/ObjectType.java b/OsmAnd-java/src/net/osmand/search/core/ObjectType.java index 2963e92126..b9f21f01d1 100644 --- a/OsmAnd-java/src/net/osmand/search/core/ObjectType.java +++ b/OsmAnd-java/src/net/osmand/search/core/ObjectType.java @@ -21,4 +21,8 @@ public enum ObjectType { return hasLocation; } + public static boolean isAddress(ObjectType t ) { + return t == CITY || t == VILLAGE || t == POSTCODE || t == STREET || t == HOUSE || t == STREET_INTERSECTION; + } + } diff --git a/OsmAnd-java/src/net/osmand/search/core/SearchResult.java b/OsmAnd-java/src/net/osmand/search/core/SearchResult.java index 07378cb324..a83627f2ae 100644 --- a/OsmAnd-java/src/net/osmand/search/core/SearchResult.java +++ b/OsmAnd-java/src/net/osmand/search/core/SearchResult.java @@ -1,7 +1,6 @@ package net.osmand.search.core; import java.util.Collection; -import java.util.List; import net.osmand.binary.BinaryMapIndexReader; import net.osmand.data.LatLon;