From 04df3d987c6ef6e8612502f00c68a8b0cce4789b Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Wed, 4 Apr 2018 12:33:59 +0300 Subject: [PATCH] Remove search terms from WikivoyageSearchResult; make wikivoyage search query distinct --- .../plus/wikivoyage/data/WikivoyageDbHelper.java | 15 ++++++--------- .../wikivoyage/data/WikivoyageSearchResult.java | 5 ----- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java index 04f70d8dec..5391933938 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java @@ -62,8 +62,7 @@ public class WikivoyageDbHelper { private static final String SEARCH_COL_ARTICLE_TITLE = "article_title"; private static final String SEARCH_COL_LANG = "lang"; - private static final String SEARCH_QUERY = "SELECT " + - SEARCH_COL_SEARCH_TERM + ", " + + private static final String SEARCH_QUERY = "SELECT DISTINCT " + SEARCH_TABLE_NAME + "." + SEARCH_COL_CITY_ID + ", " + SEARCH_COL_ARTICLE_TITLE + ", " + SEARCH_TABLE_NAME + "." + SEARCH_COL_LANG + ", " + @@ -144,7 +143,6 @@ public class WikivoyageDbHelper { } prev.articleTitles.add(insInd, rs.articleTitles.get(0)); prev.langs.add(insInd, rs.langs.get(0)); - prev.searchTerms.add(insInd, rs.searchTerms.get(0)); } else { wikivoyage.put(rs.cityId, rs); } @@ -183,12 +181,11 @@ public class WikivoyageDbHelper { private WikivoyageSearchResult readSearchResult(SQLiteCursor cursor) { WikivoyageSearchResult res = new WikivoyageSearchResult(); - res.searchTerms.add(cursor.getString(0)); - res.cityId = cursor.getLong(1); - res.articleTitles.add(cursor.getString(2)); - res.langs.add(cursor.getString(3)); - res.isPartOf = cursor.getString(4); - res.imageTitle = cursor.getString(5); + res.cityId = cursor.getLong(0); + res.articleTitles.add(cursor.getString(1)); + res.langs.add(cursor.getString(2)); + res.isPartOf = cursor.getString(3); + res.imageTitle = cursor.getString(4); return res; } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java index 59d60ea5aa..ab50ba563c 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java @@ -9,17 +9,12 @@ public class WikivoyageSearchResult { private static final int SHOW_LANGS = 3; - List searchTerms = new ArrayList<>(); long cityId; List articleTitles = new ArrayList<>(); List langs = new ArrayList<>(); String isPartOf; String imageTitle; - public List getSearchTerms() { - return searchTerms; - } - public long getCityId() { return cityId; }