faster appearance of search result page (but complete search time is the same)

this was inspired by http://bugs.yacy.net/view.php?id=37

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7801 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent f7ca84cfc0
commit 6d9e5865ee

@ -628,9 +628,6 @@ public class yacysearch {
sb.getConfigLong(SwitchboardConstants.REMOTESEARCH_MAXTIME_USER, sb.getConfigLong(SwitchboardConstants.REMOTESEARCH_MAXTIME_DEFAULT, 3000)), sb.getConfigLong(SwitchboardConstants.REMOTESEARCH_MAXTIME_USER, sb.getConfigLong(SwitchboardConstants.REMOTESEARCH_MAXTIME_DEFAULT, 3000)),
(int) sb.getConfigLong(SwitchboardConstants.DHT_BURST_ROBINSON, 0), (int) sb.getConfigLong(SwitchboardConstants.DHT_BURST_ROBINSON, 0),
(int) sb.getConfigLong(SwitchboardConstants.DHT_BURST_MULTIWORD, 0)); (int) sb.getConfigLong(SwitchboardConstants.DHT_BURST_MULTIWORD, 0));
try {
Thread.sleep(global ? 100 : 10);
} catch (final InterruptedException e1) {} // wait a little time to get first results in the search
if (offset == 0) { if (offset == 0) {
if (sitehost != null && sb.getConfigBool("heuristic.site", false) && authenticated) { if (sitehost != null && sb.getConfigBool("heuristic.site", false) && authenticated) {

@ -21,7 +21,6 @@ public class yacysearchlatestinfo {
return prop; return prop;
} }
final QueryParams theQuery = theSearch.getQuery(); final QueryParams theQuery = theSearch.getQuery();
//if (sb.isGlobalMode() && !theQuery.isLocal()) try {Thread.sleep(1000);} catch (InterruptedException e) {}
// dynamically update count values // dynamically update count values
final int totalcount = theSearch.getRankingResult().getLocalIndexCount() - theSearch.getRankingResult().getMissCount() - theSearch.getRankingResult().getSortOutCount() + theSearch.getRankingResult().getRemoteIndexCount(); final int totalcount = theSearch.getRankingResult().getLocalIndexCount() - theSearch.getRankingResult().getMissCount() - theSearch.getRankingResult().getSortOutCount() + theSearch.getRankingResult().getRemoteIndexCount();

@ -129,6 +129,8 @@ public class ResultFetcher {
public ResultEntry oneResult(final int item, final long timeout) { public ResultEntry oneResult(final int item, final long timeout) {
// check if we already retrieved this item // check if we already retrieved this item
// (happens if a search pages is accessed a second time) // (happens if a search pages is accessed a second time)
if (!this.query.isLocal() && item == 0) try { Thread.sleep(100); } catch (final InterruptedException e1) {} // wait a little time to get first results in the search
final long finishTime = System.currentTimeMillis() + timeout; final long finishTime = System.currentTimeMillis() + timeout;
EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(this.query.id(true), SearchEvent.Type.ONERESULT, "started, item = " + item + ", available = " + this.result.sizeAvailable(), 0, 0), false); EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(this.query.id(true), SearchEvent.Type.ONERESULT, "started, item = " + item + ", available = " + this.result.sizeAvailable(), 0, 0), false);
if (this.result.sizeAvailable() > item) { if (this.result.sizeAvailable() > item) {
@ -212,7 +214,7 @@ public class ResultFetcher {
while ( this.result.sizeAvailable() < this.query.neededResults() && while ( this.result.sizeAvailable() < this.query.neededResults() &&
anyWorkerAlive() && anyWorkerAlive() &&
System.currentTimeMillis() < timeout) { System.currentTimeMillis() < timeout) {
try {Thread.sleep(20);} catch (final InterruptedException e) {} try {Thread.sleep(10);} catch (final InterruptedException e) {}
//System.out.println("+++DEBUG-completeResults+++ sleeping " + 200); //System.out.println("+++DEBUG-completeResults+++ sleeping " + 200);
} }
return this.result.list(Math.min(this.query.neededResults(), this.result.sizeAvailable())); return this.result.list(Math.min(this.query.neededResults(), this.result.sizeAvailable()));

Loading…
Cancel
Save