Skip to content

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

fixed search access tracker

orbitere90afa9483c5
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java
index b0af8ff05..84eae6c44 100644
--- a/htroot/yacy/search.java
+++ b/htroot/yacy/search.java
@@ -231,21 +231,6 @@ public final class search {
}
prop.putASIS("indexabstract", new String(indexabstract));
- // prepare search statistics
- Long trackerHandle = new Long(System.currentTimeMillis());
- String client = (String) header.get("CLIENTIP");
- HashMap searchProfile = theQuery.resultProfile(System.currentTimeMillis() - timestamp);
- searchProfile.put("host", client);
- yacySeed remotepeer = yacyCore.seedDB.lookupByIP(natLib.getInetAddress(client), true, false, false);
- searchProfile.put("peername", (remotepeer == null) ? "unknown" : remotepeer.getName());
- searchProfile.put("time", trackerHandle);
- sb.remoteSearches.add(searchProfile);
-
- TreeSet handles = (TreeSet) sb.remoteSearchTracker.get(client);
- if (handles == null) handles = new TreeSet();
- handles.add(trackerHandle);
- sb.remoteSearchTracker.put(client, handles);
-
// prepare result
if ((joincount == 0) || (accu == null)) {
@@ -274,6 +259,20 @@ public final class search {
prop.putASIS("fwhop", ""); // hops (depth) of forwards that had been performed to construct this result
prop.putASIS("fwsrc", ""); // peers that helped to construct this result
prop.putASIS("fwrec", ""); // peers that would have helped to construct this result (recommendations)
+
+ // prepare search statistics
+ Long trackerHandle = new Long(System.currentTimeMillis());
+ HashMap searchProfile = theQuery.resultProfile(joincount, System.currentTimeMillis() - timestamp);
+ String client = (String) header.get("CLIENTIP");
+ searchProfile.put("host", client);
+ yacySeed remotepeer = yacyCore.seedDB.lookupByIP(natLib.getInetAddress(client), true, false, false);
+ searchProfile.put("peername", (remotepeer == null) ? "unknown" : remotepeer.getName());
+ searchProfile.put("time", trackerHandle);
+ sb.remoteSearches.add(searchProfile);
+ TreeSet handles = (TreeSet) sb.remoteSearchTracker.get(client);
+ if (handles == null) handles = new TreeSet();
+ handles.add(trackerHandle);
+ sb.remoteSearchTracker.put(client, handles);
// log
yacyCore.log.logInfo("EXIT HASH SEARCH: " +
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index f2027917d..8e654847f 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -313,7 +313,7 @@ public class yacysearch {
// prepare search statistics
Long trackerHandle = new Long(System.currentTimeMillis());
- HashMap searchProfile = theQuery.resultProfile(System.currentTimeMillis() - timestamp);
+ HashMap searchProfile = theQuery.resultProfile(theSearch.getLocalCount() + theSearch.getGlobalCount(), System.currentTimeMillis() - timestamp);
searchProfile.put("querystring", theQuery.queryString);
searchProfile.put("time", trackerHandle);
searchProfile.put("host", client);
diff --git a/source/de/anomic/plasma/plasmaSearchQuery.java b/source/de/anomic/plasma/plasmaSearchQuery.java
index 5a298cbff..3789e12b3 100644
--- a/source/de/anomic/plasma/plasmaSearchQuery.java
+++ b/source/de/anomic/plasma/plasmaSearchQuery.java
@@ -239,14 +239,14 @@ public final class plasmaSearchQuery {
return hashSet2hashString(this.queryHashes) + "-" + hashSet2hashString(this.excludeHashes) + ":" + this.contentdom;
}
- public HashMap resultProfile(long searchtime) {
+ public HashMap resultProfile(int searchcount, long searchtime) {
// generate statistics about search: query, time, etc
HashMap r = new HashMap();
r.put("queryhashes", queryHashes);
r.put("querystring", queryString);
r.put("querycount", new Integer(linesPerPage));
r.put("querytime", new Long(maximumTime));
- //r.put("resultcount", new Integer(searchcount));
+ r.put("resultcount", new Integer(searchcount));
r.put("resulttime", new Long(searchtime));
return r;
}