diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java
index 2ae4637e3..ded76570f 100644
--- a/htroot/yacy/search.java
+++ b/htroot/yacy/search.java
@@ -280,7 +280,7 @@ public final class search {
theSearch = SearchEventCache.getEvent(theQuery, sb.peers, sb.crawlResults, null, true);
// set statistic details of search result and find best result index set
- if (theSearch.getRankingResult().getLocalResourceSize() == 0) {
+ if (theSearch.getRankingResult().getLocalIndexCount() == 0) {
prop.put("indexcount", "");
prop.put("joincount", "0");
} else {
@@ -304,11 +304,11 @@ public final class search {
}
prop.put("indexcount", indexcount.toString());
- if (theSearch.getRankingResult().getLocalResourceSize() == 0) {
+ if (theSearch.getRankingResult().getLocalIndexCount() == 0) {
joincount = 0;
prop.put("joincount", "0");
} else {
- joincount = theSearch.getRankingResult().getLocalResourceSize();
+ joincount = theSearch.getRankingResult().getLocalIndexCount();
prop.put("joincount", Integer.toString(joincount));
accu = theSearch.result().completeResults(3000);
}
@@ -379,7 +379,7 @@ public final class search {
// prepare search statistics
theQuery.remotepeer = sb.peers.lookupByIP(natLib.getInetAddress(client), true, false, false);
- theQuery.resultcount = (theSearch == null) ? 0 : theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize();
+ theQuery.resultcount = (theSearch == null) ? 0 : theSearch.getRankingResult().getLocalIndexCount() + theSearch.getRankingResult().getRemoteResourceSize();
theQuery.searchtime = System.currentTimeMillis() - timestamp;
theQuery.urlretrievaltime = (theSearch == null) ? 0 : theSearch.result().getURLRetrievalTime();
theQuery.snippetcomputationtime = (theSearch == null) ? 0 : theSearch.result().getSnippetComputationTime();
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index d9de079ee..88acbbbd3 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -480,6 +480,7 @@ public class yacysearch {
offset = 0;
}
final SearchEvent theSearch = SearchEventCache.getEvent(theQuery, sb.peers, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);
+ try {Thread.sleep(100);} catch (InterruptedException e1) {} // wait a little time to get first results in the search
// generate result object
//serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + (System.currentTimeMillis() - timestamp) + " ms");
@@ -490,11 +491,11 @@ public class yacysearch {
// log
Log.logInfo("LOCAL_SEARCH", "EXIT WORD SEARCH: " + theQuery.queryString + " - " +
- (theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize()) + " links found, " +
+ (theSearch.getRankingResult().getLocalIndexCount() + theSearch.getRankingResult().getRemoteResourceSize()) + " links found, " +
(System.currentTimeMillis() - timestamp) + " ms");
// prepare search statistics
- theQuery.resultcount = theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize();
+ theQuery.resultcount = theSearch.getRankingResult().getLocalIndexCount() + theSearch.getRankingResult().getRemoteResourceSize();
theQuery.searchtime = System.currentTimeMillis() - timestamp;
theQuery.urlretrievaltime = theSearch.result().getURLRetrievalTime();
theQuery.snippetcomputationtime = theSearch.result().getSnippetComputationTime();
@@ -570,13 +571,12 @@ public class yacysearch {
Log.logException(e);
}
- final int totalcount = theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize();
prop.put("num-results_offset", offset);
prop.put("num-results_itemscount", Formatter.number(0, true));
prop.put("num-results_itemsPerPage", itemsPerPage);
- prop.put("num-results_totalcount", Formatter.number(totalcount, true));
+ prop.put("num-results_totalcount", Formatter.number(theSearch.getRankingResult().getLocalIndexCount() + theSearch.getRankingResult().getRemoteResourceSize(), true));
prop.put("num-results_globalresults", (globalsearch) ? "1" : "0");
- prop.put("num-results_globalresults_localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalResourceSize(), true));
+ prop.put("num-results_globalresults_localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalIndexCount(), true));
prop.put("num-results_globalresults_remoteResourceSize", Formatter.number(theSearch.getRankingResult().getRemoteResourceSize(), true));
prop.put("num-results_globalresults_remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true));
prop.put("num-results_globalresults_remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true));
@@ -591,7 +591,7 @@ public class yacysearch {
resnav.append(QueryParams.navurl("html", thispage - 1, display, theQuery, originalUrlMask, null, navigation));
resnav.append("\">
");
}
- final int numberofpages = Math.min(10, Math.max(thispage + 1, totalcount / theQuery.displayResults()));
+ final int numberofpages = Math.min(10, Math.max(1 + thispage, 1 + ((theSearch.getRankingResult().getLocalIndexCount() < 11) ? theSearch.getRankingResult().getLocalResourceSize() : theSearch.getRankingResult().getLocalIndexCount()) / theQuery.displayResults()));
for (int i = 0; i < numberofpages; i++) {
if (i == thispage) {
resnav.append("
6) ? 1 : 0); // if there are more results than may fit on the page we add a navigation at the bottom
+ prop.put("pageNavBottom", (theSearch.getRankingResult().getLocalIndexCount() - offset > 6) ? 1 : 0); // if there are more results than may fit on the page we add a navigation at the bottom
prop.put("pageNavBottom_resnav", resnavs);
// generate the search result lines; the content will be produced by another servlet
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index 4e4921248..562050357 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -86,12 +86,12 @@ public class yacysearchitem {
final QueryParams theQuery = theSearch.getQuery();
// dynamically update count values
- final int totalcount = theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize();
+ final int totalcount = theSearch.getRankingResult().getLocalIndexCount() + theSearch.getRankingResult().getRemoteResourceSize();
final int offset = theQuery.neededResults() - theQuery.displayResults() + 1;
prop.put("offset", offset);
prop.put("itemscount", Formatter.number(Math.min((item < 0) ? theQuery.neededResults() : item + 1, totalcount)));
prop.put("totalcount", Formatter.number(totalcount, true));
- prop.put("localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalResourceSize(), true));
+ prop.put("localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalIndexCount(), true));
prop.put("remoteResourceSize", Formatter.number(theSearch.getRankingResult().getRemoteResourceSize(), true));
prop.put("remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true));
prop.put("remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true));
diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java
index b6b532adf..ec00474c8 100644
--- a/htroot/yacysearchtrailer.java
+++ b/htroot/yacysearchtrailer.java
@@ -137,7 +137,7 @@ public class yacysearchtrailer {
String aboutBody = env.getConfig("about.body", "");
String aboutHeadline = env.getConfig("about.headline", "");
if ((aboutBody.length() == 0 && aboutHeadline.length() == 0) ||
- theSearch.getRankingResult().getLocalResourceSize() +
+ theSearch.getRankingResult().getLocalIndexCount() +
theSearch.getRankingResult().getRemoteResourceSize() == 0) {
prop.put("nav-about", 0);
} else {
diff --git a/source/de/anomic/search/RankingProcess.java b/source/de/anomic/search/RankingProcess.java
index 1e66638fd..abb77c76e 100644
--- a/source/de/anomic/search/RankingProcess.java
+++ b/source/de/anomic/search/RankingProcess.java
@@ -73,7 +73,8 @@ public final class RankingProcess extends Thread {
//private final int[] domZones;
private HashMap> localSearchInclusion;
- private int remote_peerCount, remote_indexCount, remote_resourceSize, local_resourceSize;
+ private int remote_resourceSize, remote_indexCount, remote_peerCount;
+ private int local_resourceSize, local_indexCount;
private final SortStack stack;
private int feeders;
private final ConcurrentHashMap> doubleDomCache; // key = domhash (6 bytes); value = like stack
@@ -96,9 +97,10 @@ public final class RankingProcess extends Thread {
this.order = order;
this.maxentries = maxentries;
this.remote_peerCount = 0;
- this.remote_indexCount = 0;
this.remote_resourceSize = 0;
+ this.remote_indexCount = 0;
this.local_resourceSize = 0;
+ this.local_indexCount = 0;
this.urlhashes = new ConcurrentHashMap(0, 0.75f, concurrency);
this.misses = new TreeSet();
this.flagcount = new int[32];
@@ -140,7 +142,7 @@ public final class RankingProcess extends Thread {
return;
}
- add(index, true, index.size());
+ add(index, true, -1);
} catch (final Exception e) {
Log.logException(e);
}
@@ -153,8 +155,9 @@ public final class RankingProcess extends Thread {
assert (index != null);
if (index.isEmpty()) return;
+
if (local) {
- this.local_resourceSize += fullResource;
+ this.local_resourceSize += index.size();
} else {
this.remote_resourceSize += fullResource;
this.remote_peerCount++;
@@ -229,9 +232,9 @@ public final class RankingProcess extends Thread {
filteredEntries.add(iEntry);
// increase counter for statistics
- if (!local) this.remote_indexCount++;
+ if (local) this.local_indexCount++; else this.remote_indexCount++;
}
-
+
// do the ranking
for (WordReferenceVars fEntry: filteredEntries) {
@@ -487,24 +490,29 @@ public final class RankingProcess extends Thread {
return this.stack.size();
}
+ public int getLocalIndexCount() {
+ // the number of results in the local peer after filtering
+ return this.local_indexCount;
+ }
+
+ public int getLocalResourceSize() {
+ // the number of hits in the local peer (index size, size of the collection in the own index)
+ return this.local_resourceSize;
+ }
+
public int getRemoteIndexCount() {
// the number of result contributions from all the remote peers
return this.remote_indexCount;
}
- public int getRemotePeerCount() {
- // the number of remote peers that have contributed
- return this.remote_peerCount;
- }
-
public int getRemoteResourceSize() {
// the number of all hits in all the remote peers
return this.remote_resourceSize;
}
- public int getLocalResourceSize() {
- // the number of hits in the local peer (index size, size of the collection in the own index)
- return this.local_resourceSize;
+ public int getRemotePeerCount() {
+ // the number of remote peers that have contributed
+ return this.remote_peerCount;
}
public void remove(final WordReferenceVars reference) {