Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
prevent that a local Solr search and a local RWI search are running concurrently. When a RWI search result is flushed into the result set, id does Solr Queries (which replaced the old-style Metadata Queries) and they are possibly running concurrently to a previously startet Solr search. Both methods may block each other with IO. To enhance the speed, they are now serialized. Because the Solr search results may result in better results using the more advanced and configurable Ranking methods, this result is preverred over the RWI search result. However, remote RWI search results are still feeded concurrently into the search result as well.
Michael Peter Christen30276a2b482a
diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.javaindex 7a241bbec..abf648d3d 100644--- a/source/net/yacy/search/query/SearchEvent.java+++ b/source/net/yacy/search/query/SearchEvent.java@@ -304,7 +304,7 @@ public final class SearchEvent {this.rwiProcess = null;if (query.getSegment().connectedRWI() && !Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.DEBUG_SEARCH_LOCAL_DHT_OFF, false)) {// we start the local search only if this peer is doing a remote search or when it is doing a local search and the peer is old- rwiProcess = new RWIProcess();+ rwiProcess = new RWIProcess(this.localsolrsearch);rwiProcess.start();}@@ -433,8 +433,11 @@ public final class SearchEvent {private class RWIProcess extends Thread {- public RWIProcess() {+ final Thread waitForThread;++ public RWIProcess(final Thread waitForThread) {super();+ this.waitForThread = waitForThread;}@Override@@ -462,6 +465,12 @@ public final class SearchEvent {SearchEvent.this.localSearchInclusion = search.inclusion();ReferenceContainer<WordReference> index = search.joined();if ( !index.isEmpty() ) {+ // in case that another thread has priority for their results, wait until this is finished+ if (this.waitForThread != null && this.waitForThread.isAlive()) {+ this.waitForThread.join();+ }++ // add the index to the resultint successcount = addRWIs(index, true, "local index: " + SearchEvent.this.query.getSegment().getLocation(), index.size(), SearchEvent.this.maxtime);if (successcount == 0 &&SearchEvent.this.query.getQueryGoal().getIncludeHashes().has(Segment.catchallHash) &&