From 1f0f77bb779bcb9d5620601ab29e23c4eb74baf4 Mon Sep 17 00:00:00 2001 From: reger Date: Wed, 1 Apr 2015 01:57:56 +0200 Subject: [PATCH] make location facet return results for location nav facet of field coordinate_p does not return results, now using coordinate_p_0_coordinate as alternative to get facet counts. As the actual facet value is not used this should not harm any analysis (even if facet is a incomplete location). If facet value is used in future likely *_geohash field could be introduced (for facet and other ... as transport value) --- source/net/yacy/search/query/QueryParams.java | 6 ++++-- source/net/yacy/search/query/SearchEvent.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/net/yacy/search/query/QueryParams.java b/source/net/yacy/search/query/QueryParams.java index 719376a72..2f50b1307 100644 --- a/source/net/yacy/search/query/QueryParams.java +++ b/source/net/yacy/search/query/QueryParams.java @@ -93,7 +93,7 @@ public final class QueryParams { private static final Map defaultfacetfields = new HashMap(); static { // the key shall match with configuration property search.navigation - defaultfacetfields.put("location", CollectionSchema.coordinate_p); + defaultfacetfields.put("location", CollectionSchema.coordinate_p_0_coordinate); // coordinate_p can't be used for facet (subfields), as value isn't used subfield can be used defaultfacetfields.put("hosts", CollectionSchema.host_s); defaultfacetfields.put("protocol", CollectionSchema.url_protocol_s); defaultfacetfields.put("filetype", CollectionSchema.url_file_ext_s); @@ -249,7 +249,9 @@ public final class QueryParams { for (String navkey: search_navigation) { CollectionSchema f = defaultfacetfields.get(navkey); // handle special field, authors_sxt (add to facet w/o contains check, as authors_sxt is not enabled (is copyfield)) - if (f != null && (solrSchema.contains(f) || f.name().equals("author_sxt"))) this.facetfields.add(f.getSolrFieldName()); + // dto. for coordinate_p_0_coordinate is not enabled but used for location facet (because coordinate_p not valid for facet field) + if (f != null && (solrSchema.contains(f) || f.name().equals("author_sxt") || f.name().equals("coordinate_p_0_coordinate") )) + this.facetfields.add(f.getSolrFieldName()); } if (LibraryProvider.autotagging != null) for (Tagging v: LibraryProvider.autotagging.getVocabularies()) { if (v.isFacet()) { diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java index b560da446..0232c252a 100644 --- a/source/net/yacy/search/query/SearchEvent.java +++ b/source/net/yacy/search/query/SearchEvent.java @@ -795,7 +795,7 @@ public final class SearchEvent { // collect navigation information ReversibleScoreMap fcts; if (this.locationNavigator != null) { - fcts = facets.get(CollectionSchema.coordinate_p.getSolrFieldName()); + fcts = facets.get(CollectionSchema.coordinate_p_0_coordinate.getSolrFieldName()); if (fcts != null) { for (String coordinate: fcts) { int hc = fcts.get(coordinate);