Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added location navigator which causes that the image to the map search is visible whenever a location is available in the search result. To activate this, the search.navigation property in yacy.conf must be modified to the new default values.
orbiter8ac2e8c8c9f7
diff --git a/defaults/yacy.init b/defaults/yacy.initindex 1174be8df..7339c3f02 100644--- a/defaults/yacy.init+++ b/defaults/yacy.init@@ -772,7 +772,7 @@ search.result.show.tags = false# search navigators: comma-separated list of default values for search navigation.# can be temporary different if search string is given with differen navigation values# assigning no value(s) means that no navigation is shown-search.navigation=hosts,authors,namespace,topics,filetype,protocol+search.navigation=location,hosts,authors,namespace,topics,filetype,protocol# search result verification and snippet fetch caching rules# each search result can be verified byloading the link from the webdiff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.javaindex b95d284d7..9f3b7ff95 100644--- a/htroot/IndexControlRWIs_p.java+++ b/htroot/IndexControlRWIs_p.java@@ -635,7 +635,8 @@ public class IndexControlRWIs_p {"",//userAgentfalse,false,- 0.0d, 0.0d, 0.0d);+ 0.0d, 0.0d, 0.0d,+ new String[0]);final SearchEvent theSearch = SearchEventCache.getEvent(query, sb.peers, sb.tables, null, false, sb.loader, Integer.MAX_VALUE, Long.MAX_VALUE, (int) sb.getConfigLong(SwitchboardConstants.DHT_BURST_ROBINSON, 0), (int) sb.getConfigLong(SwitchboardConstants.DHT_BURST_MULTIWORD, 0));if (theSearch.rwiProcess != null && theSearch.rwiProcess.isAlive()) try {theSearch.rwiProcess.join();} catch (final InterruptedException e) {}if (theSearch.local_rwi_available.get() == 0) {diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex 13f40f22b..d1bfcf3fd 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -251,7 +251,8 @@ public final class search {false,0.0d,0.0d,- 0.0d+ 0.0d,+ new String[0]);Network.log.info("INIT HASH SEARCH (abstracts only): " + QueryParams.anonymizedQueryHashes(theQuery.getQueryGoal().getIncludeHashes()) + " - " + theQuery.itemsPerPage() + " links");@@ -315,7 +316,8 @@ public final class search {false,0.0d,0.0d,- 0.0d+ 0.0d,+ new String[0]);Network.log.info("INIT HASH SEARCH (query-" + abstracts + "): " + QueryParams.anonymizedQueryHashes(theQuery.getQueryGoal().getIncludeHashes()) + " - " + theQuery.itemsPerPage() + " links");EventChannel.channels(EventChannel.REMOTESEARCH).addMessage(new RSSMessage("Remote Search Request from " + ((remoteSeed == null) ? "unknown" : remoteSeed.getName()), QueryParams.anonymizedQueryHashes(theQuery.getQueryGoal().getIncludeHashes()), ""));diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex cd9e38ff3..a78030bc8 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -668,7 +668,8 @@ public class yacysearch {&& sb.getConfigBool(SwitchboardConstants.NETWORK_SEARCHVERIFY, false)&& sb.peers.mySeed().getFlagAcceptRemoteIndex(),false,- lat, lon, rad);+ lat, lon, rad,+ sb.getConfig("search_navigation","").split(","));EventTracker.delete(EventTracker.EClass.SEARCH);EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.EventSearch(theQuery.id(true),diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.javaindex ac576f339..05bdfb15d 100644--- a/htroot/yacysearchtrailer.java+++ b/htroot/yacysearchtrailer.java@@ -387,7 +387,8 @@ public class yacysearchtrailer {// category: location search// show only if there is a location database present and if there had been any search results- if (LibraryProvider.geoLoc.isEmpty() || theSearch.getResultCount() == 0) {+ if ((LibraryProvider.geoLoc.isEmpty() || theSearch.getResultCount() == 0) &&+ (theSearch.locationNavigator == null || theSearch.locationNavigator.isEmpty())) {prop.put("cat-location", 0);} else {prop.put("cat-location", 1);diff --git a/source/net/yacy/search/query/QueryParams.java b/source/net/yacy/search/query/QueryParams.javaindex f4c540839..d5b99a077 100644--- a/source/net/yacy/search/query/QueryParams.java+++ b/source/net/yacy/search/query/QueryParams.java@@ -79,8 +79,16 @@ public final class QueryParams {}}- private static final CollectionSchema[] defaultfacetfields = new CollectionSchema[]{- CollectionSchema.host_s, CollectionSchema.url_protocol_s, CollectionSchema.url_file_ext_s, CollectionSchema.author_sxt};+ private static final Map<String, CollectionSchema> defaultfacetfields = new HashMap<String, CollectionSchema>();+ static {+ // the key shall match with configuration property search.navigation+ defaultfacetfields.put("location", CollectionSchema.coordinate_p);+ defaultfacetfields.put("hosts", CollectionSchema.host_s);+ defaultfacetfields.put("protocol", CollectionSchema.url_protocol_s);+ defaultfacetfields.put("filetype", CollectionSchema.url_file_ext_s);+ defaultfacetfields.put("authors", CollectionSchema.author_sxt);+ //missing: namespace+ }private static final int defaultmaxfacets = 30;private static final String ampersand = "&";@@ -132,7 +140,8 @@ public final class QueryParams {final Bitfield constraint,final Segment indexSegment,final RankingProfile ranking,- final String userAgent) {+ final String userAgent,+ final String[] search_navigation) {this.queryGoal = new QueryGoal(query_original, query_words);this.ranking = ranking;this.modifier = new QueryModifier();@@ -169,8 +178,9 @@ public final class QueryParams {this.facetfields = new LinkedHashSet<String>();this.solrSchema = indexSegment.fulltext().getDefaultConfiguration();- for (CollectionSchema f: defaultfacetfields) {- if (solrSchema.contains(f)) facetfields.add(f.getSolrFieldName());+ for (String navkey: search_navigation) {+ CollectionSchema f = defaultfacetfields.get(navkey);+ if (f != null && solrSchema.contains(f)) facetfields.add(f.getSolrFieldName());}for (Tagging v: LibraryProvider.autotagging.getVocabularies()) this.facetfields.add(CollectionSchema.VOCABULARY_PREFIX + v.getName() + CollectionSchema.VOCABULARY_SUFFIX);this.maxfacets = defaultmaxfacets;@@ -205,7 +215,8 @@ public final class QueryParams {final boolean filterscannerfail,final double lat,final double lon,- final double radius+ final double radius,+ final String[] search_navigation) {this.queryGoal = queryGoal;this.modifier = modifier;@@ -269,8 +280,9 @@ public final class QueryParams {this.facetfields = new LinkedHashSet<String>();this.solrSchema = indexSegment.fulltext().getDefaultConfiguration();- for (CollectionSchema f: defaultfacetfields) {- if (solrSchema.contains(f)) facetfields.add(f.getSolrFieldName());+ for (String navkey: search_navigation) {+ CollectionSchema f = defaultfacetfields.get(navkey);+ if (f != null && solrSchema.contains(f)) facetfields.add(f.getSolrFieldName());}for (Tagging v: LibraryProvider.autotagging.getVocabularies()) this.facetfields.add(CollectionSchema.VOCABULARY_PREFIX + v.getName() + CollectionSchema.VOCABULARY_SUFFIX);this.maxfacets = defaultmaxfacets;diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.javaindex a34300d82..bc1a5a584 100644--- a/source/net/yacy/search/query/SearchEvent.java+++ b/source/net/yacy/search/query/SearchEvent.java@@ -136,6 +136,7 @@ public final class SearchEvent {private Thread localsolrsearch;private int localsolroffset;private final AtomicInteger expectedRemoteReferences, maxExpectedRemoteReferences; // counter for referenced that had been sorted out for other reasons+ public final ScoreMap<String> locationNavigator; // a counter for the appearance of location coordinatespublic final ScoreMap<String> hostNavigator; // a counter for the appearance of host namespublic final ScoreMap<String> authorNavigator; // a counter for the appearances of authorspublic final ScoreMap<String> namespaceNavigator; // a counter for name spaces@@ -225,6 +226,7 @@ public final class SearchEvent {this.excludeintext_image = Switchboard.getSwitchboard().getConfigBool("search.excludeintext.image", true);// prepare configured search navigationfinal String navcfg = Switchboard.getSwitchboard().getConfig("search.navigation", "");+ this.locationNavigator = navcfg.contains("location") ? new ConcurrentScoreMap<String>() : null;this.authorNavigator = navcfg.contains("authors") ? new ConcurrentScoreMap<String>() : null;this.namespaceNavigator = navcfg.contains("namespace") ? new ConcurrentScoreMap<String>() : null;this.hostNavigator = navcfg.contains("hosts") ? new ConcurrentScoreMap<String>() : null;@@ -741,6 +743,17 @@ public final class SearchEvent {// collect navigation informationReversibleScoreMap<String> fcts;+ if (this.locationNavigator != null) {+ fcts = facets.get(CollectionSchema.coordinate_p.getSolrFieldName());+ if (fcts != null) {+ for (String coordinate: fcts) {+ int hc = fcts.get(coordinate);+ if (hc == 0) continue;+ this.locationNavigator.inc(coordinate, hc);+ }+ }+ }+if (this.hostNavigator != null) {fcts = facets.get(CollectionSchema.host_s.getSolrFieldName());if (fcts != null) {