Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- wait until local results are computed during search, see http://forum.yacy-websuche.de/viewtopic.php?f=5&t=2167&hilit=&p=15521#p15521 - show only x+1 pages in page navigator

orbitera0c53abbe1f6
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 33d9ae8c0..16988ad58 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -463,7 +463,7 @@ public class yacysearch {
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");
diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java
index 782333ebc..e044f33bc 100644
--- a/htroot/yacysearchtrailer.java
+++ b/htroot/yacysearchtrailer.java
@@ -74,8 +74,8 @@ public class yacysearchtrailer {
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)
diff --git a/source/de/anomic/plasma/plasmaSearchEvent.java b/source/de/anomic/plasma/plasmaSearchEvent.java
index f063a0bb2..442552a12 100644
--- a/source/de/anomic/plasma/plasmaSearchEvent.java
+++ b/source/de/anomic/plasma/plasmaSearchEvent.java
@@ -138,13 +138,18 @@ public final class plasmaSearchEvent {
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),
@@ -167,10 +172,6 @@ public final class plasmaSearchEvent {
(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 {
@@ -598,9 +599,8 @@ public final class plasmaSearchEvent {
// 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