From 59ead8f7dc87479a4ed334db5e482416c8faa0d2 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 30 Mar 2018 13:25:12 +0200 Subject: [PATCH] Fix search --- .../net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java index 22422ceb11..0a93c8008b 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java @@ -11,6 +11,7 @@ import net.osmand.CollatorStringMatcher.StringMatcherMode; import net.osmand.plus.OsmandApplication; import net.osmand.plus.api.SQLiteAPI.SQLiteConnection; import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; +import net.osmand.plus.api.SQLiteAPI.SQLiteStatement; import net.osmand.util.Algorithms; import gnu.trove.map.hash.TLongObjectHashMap; @@ -82,7 +83,7 @@ public class WikivoyageDbHelper { SQLiteConnection conn = openConnection(); if (conn != null) { try { - String dbQuery = SEARCH_TABLE_SELECT + " WHERE " + SEARCH_COL_SEARCH_TERM + " LIKE ?"; + String dbQuery = SEARCH_TABLE_SELECT + " WHERE city_id IN (select city_id from wikivoyage_search where search_term like ?)"; SQLiteCursor cursor = conn.rawQuery(dbQuery, new String[] { searchQuery + "%" }); if (cursor.moveToFirst()) { do { @@ -94,7 +95,7 @@ public class WikivoyageDbHelper { conn.close(); } } - List list = new ArrayList(groupSearchResultsByCityId(res)); + List list = new ArrayList<>(groupSearchResultsByCityId(res)); Collections.sort(list, new Comparator() {