Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Fix: avoid 0-results by using remote metadata results when available
Michael Peter Christen49f445d556ee
diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.javaindex 7696171fb..569dfccc9 100644--- a/source/net/yacy/peers/Protocol.java+++ b/source/net/yacy/peers/Protocol.java@@ -789,18 +789,24 @@ public final class Protocol {}WriteMetadataNodeToLocalIndexThread writerToLocalIndex = new WriteMetadataNodeToLocalIndexThread(event.query.getSegment(), storeDocs);writerToLocalIndex.start();- try {- writerToLocalIndex.join();- } catch(InterruptedException e) {- /*- * Current thread interruption might happen while waiting- * for writeToLocalIndexThread.- */- writerToLocalIndex.stopWriting();- throw new InterruptedException("remoteProcess stopped!");- }- event.addRWIs(container.get(0), false, target.getName() + "/" + target.hash, result.totalCount, time);- } else {+ try {+ writerToLocalIndex.join();+ } catch(InterruptedException e) {+ /*+ * Current thread interruption might happen while waiting+ * for writeToLocalIndexThread.+ */+ writerToLocalIndex.stopWriting();+ throw new InterruptedException("remoteProcess stopped!");+ }+ /* Ensure freshly stored metadata is visible to queries before adding results. */+ event.query.getSegment().fulltext().commit(true);+ if (storeDocs != null && !storeDocs.isEmpty()) {+ event.addNodes(storeDocs, null, snip, false, target.getName() + "/" + target.hash, result.totalCount, true);+ } else {+ event.addRWIs(container.get(0), false, target.getName() + "/" + target.hash, result.totalCount, time);+ }+ } else {// feed results as nodes (SolrQuery results) which carry metadata,// to prevent a call to getMetaData for RWI results, which would fail (if no metadata in index and no display of these results)event.addNodes(storeDocs, null, snip, false, target.getName() + "/" + target.hash, count, true);diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.javaindex ea3774897..31bf06c05 100644--- a/source/net/yacy/search/query/SearchEvent.java+++ b/source/net/yacy/search/query/SearchEvent.java@@ -2046,6 +2046,9 @@ public final class SearchEvent implements ScoreMapUpdatesListener {// we did not demand online loading, therefore a failure does not mean that the missing snippet causes a rejection of this result// this may happen during a remote search, because snippet loading is omitted to retrieve results fasterreturn page.makeResultEntry(this.query.getSegment(), this.peers, null); // result without snippet+ } else if (!this.query.isLocal() || cacheStrategy == CacheStrategy.IFEXIST || cacheStrategy == CacheStrategy.IFFRESH) {+ /* Do not drop remote or "use cache if available" results when snippet fetching fails. */+ return page.makeResultEntry(this.query.getSegment(), this.peers, null); // result without snippet} else {// problems with snippet fetchif (this.snippetFetchWords.contains(Segment.catchallString)) {