Skip to content

Commit

Permalink
- wait until local results are computed during search, see http://for…
Browse files Browse the repository at this point in the history
…um.yacy-websuche.de/viewtopic.php?f=5&t=2167&hilit=&p=15521#p15521

- show only x+1 pages in page navigator

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6022 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jun 4, 2009
1 parent 94f3d90 commit a0c53ab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion htroot/yacysearch.java
Expand Up @@ -463,7 +463,7 @@ public static serverObjects respond(final httpRequestHeader header, final server
resnav.append(plasmaSearchQuery.navurl("html", thispage - 1, display, theQuery, originalUrlMask, null));
resnav.append("\"><img src=\"env/grafics/navdl.gif\" width=\"16\" height=\"16\"></a>&nbsp;");
}
final int numberofpages = Math.min(10, Math.max(thispage + 2, totalcount / theQuery.displayResults()));
final int numberofpages = Math.min(10, Math.min(thispage + 2, totalcount / theQuery.displayResults()));
for (int i = 0; i < numberofpages; i++) {
if (i == thispage) {
resnav.append("<img src=\"env/grafics/navs");
Expand Down
4 changes: 2 additions & 2 deletions htroot/yacysearchtrailer.java
Expand Up @@ -74,8 +74,8 @@ public static serverObjects respond(final httpRequestHeader header, final server
prop.put("nav-domains_element_" + i + "_nl", 1);
}
i--;
prop.put("nav_domains_element_" + i + "_nl", 0);
prop.put("nav_domains_element", hostNavigator.size());
prop.put("nav-domains_element_" + i + "_nl", 0);
prop.put("nav-domains_element", hostNavigator.size());
}

// attach the bottom line with search references (topwords)
Expand Down
22 changes: 11 additions & 11 deletions source/de/anomic/plasma/plasmaSearchEvent.java
Expand Up @@ -138,13 +138,18 @@ private plasmaSearchEvent(final plasmaSearchQuery query,
final long start = System.currentTimeMillis();
if ((query.domType == plasmaSearchQuery.SEARCHDOM_GLOBALDHT) ||
(query.domType == plasmaSearchQuery.SEARCHDOM_CLUSTERALL)) {
// do a global search

// initialize a ranking process that is the target for data
// that is generated concurrently from local and global search threads
this.rankedCache = new plasmaSearchRankingProcess(indexSegment, query, max_results_preparation, 16);

final int fetchpeers = 12;

// the result of the fetch is then in the rcGlobal
// start a local search
localSearchThread = new localSearchProcess();
localSearchThread.start();

// start global searches
final long timer = System.currentTimeMillis();
final int fetchpeers = 12;
Log.logFine("SEARCH_EVENT", "STARTING " + fetchpeers + " THREADS TO CATCH EACH " + query.displayResults() + " URLs");
this.primarySearchThreads = yacySearch.primaryRemoteSearches(
plasmaSearchQuery.hashSet2hashString(query.queryHashes),
Expand All @@ -167,10 +172,6 @@ private plasmaSearchEvent(final plasmaSearchQuery query,
(query.domType == plasmaSearchQuery.SEARCHDOM_GLOBALDHT) ? null : preselectedPeerHashes);
serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), "remote search thread start", this.primarySearchThreads.length, System.currentTimeMillis() - timer), false);

// meanwhile do a local search
localSearchThread = new localSearchProcess();
localSearchThread.start();

// finished searching
Log.logFine("SEARCH_EVENT", "SEARCH TIME AFTER GLOBAL-TRIGGER TO " + primarySearchThreads.length + " PEERS: " + ((System.currentTimeMillis() - start) / 1000) + " seconds");
} else {
Expand Down Expand Up @@ -598,9 +599,8 @@ public ResultEntry oneResult(final int item) {
// search thread is started as background process
if ((localSearchThread != null) && (localSearchThread.isAlive())) {
// in case that the local search takes longer than some other
// remote search requests, do some sleeps to give the local process
// a chance to contribute
try {Thread.sleep(item * 50L);} catch (final InterruptedException e) {}
// remote search requests, wait that the local process terminates first
try {localSearchThread.join();} catch (InterruptedException e) {}
}
// now wait until as many remote worker threads have finished, as we
// want to display results
Expand Down

0 comments on commit a0c53ab

Please sign in to comment.