From e90afa9483c58e2c635ce0bbd68f46477baf3c87 Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 4 Sep 2007 09:04:47 +0000 Subject: [PATCH] fixed search access tracker git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4072 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/search.java | 29 +++++++++---------- htroot/yacysearch.java | 2 +- .../de/anomic/plasma/plasmaSearchQuery.java | 4 +-- 3 files changed, 17 insertions(+), 18 deletions(-) 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; }