From ae734b3f8d54051d2beb148950fbbdb9987285d1 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Mon, 4 Mar 2013 00:17:29 +0100 Subject: [PATCH] enhanced the search result processing - no waiting time at the end - switched on 'classic' snippet production and verification (again) --- source/net/yacy/search/query/SearchEvent.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java index e86302cc7..95d227aa7 100644 --- a/source/net/yacy/search/query/SearchEvent.java +++ b/source/net/yacy/search/query/SearchEvent.java @@ -1082,14 +1082,14 @@ public final class SearchEvent { Element localEntryElement = this.nodeStack.sizeQueue() > 0 ? this.nodeStack.poll() : null; URIMetadataNode localEntry = localEntryElement == null ? null : localEntryElement.getElement(); if (localEntry != null) { - addResult(getSnippet(localEntry, null)); + addResult(getSnippet(localEntry, this.query.snippetCacheStrategy)); success = true; } if (SearchEvent.this.snippetFetchAlive.get() >= 10) { // too many concurrent processes URIMetadataNode p2pEntry = pullOneFilteredFromRWI(true); if (p2pEntry != null) { - addResult(getSnippet(p2pEntry, null)); + addResult(getSnippet(p2pEntry, this.query.snippetCacheStrategy)); success = true; } } else { @@ -1101,7 +1101,7 @@ public final class SearchEvent { if (p2pEntry != null) { SearchEvent.this.snippetFetchAlive.incrementAndGet(); try { - addResult(getSnippet(p2pEntry, null)); + addResult(getSnippet(p2pEntry, SearchEvent.this.query.snippetCacheStrategy)); } catch (Throwable e) {} finally { SearchEvent.this.snippetFetchAlive.decrementAndGet(); } @@ -1240,6 +1240,7 @@ public final class SearchEvent { // wait until a local solr is finished, we must do that to be able to check if we need more if (this.localsolrsearch.isAlive()) {try {this.localsolrsearch.join(100);} catch (InterruptedException e) {}} + if (item >= this.localsolroffset && this.local_solr_stored.get() == 0 && this.localsolrsearch.isAlive()) {try {this.localsolrsearch.join();} catch (InterruptedException e) {}} if (item >= this.localsolroffset && this.local_solr_stored.get() >= item) { // load remaining solr results now int nextitems = item - this.localsolroffset + this.query.itemsPerPage; // example: suddenly switch to item 60, just 10 had been shown, 20 loaded. @@ -1261,9 +1262,8 @@ public final class SearchEvent { final ResultEntry re = this.resultList.element(item).getElement(); EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.EventSearch(this.query.id(true), SearchEventType.ONERESULT, "fetched, item = " + item + ", available = " + this.getResultCount() + ": " + re.urlstring(), 0, 0), false); - if (this.local_solr_stored.get() > this.localsolroffset && (item + 1) % this.query.itemsPerPage == 0) { + if (!this.localsolrsearch.isAlive() && this.local_solr_stored.get() > this.localsolroffset && (item + 1) % this.query.itemsPerPage == 0) { // at the end of a list, trigger a next solr search - if (this.localsolrsearch.isAlive()) {try {this.localsolrsearch.join();} catch (InterruptedException e) {}} this.localsolrsearch = RemoteSearch.solrRemoteSearch(this, this.localsolroffset, this.query.itemsPerPage, null /*this peer*/, Switchboard.urlBlacklist); this.localsolroffset += this.query.itemsPerPage; }