Skip to content

Commit

Permalink
fixed search access tracker
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4072 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Sep 4, 2007
1 parent 4779f31 commit e90afa9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
29 changes: 14 additions & 15 deletions htroot/yacy/search.java
Expand Up @@ -231,21 +231,6 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
}
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)) {

Expand Down Expand Up @@ -274,6 +259,20 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
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: " +
Expand Down
2 changes: 1 addition & 1 deletion htroot/yacysearch.java
Expand Up @@ -313,7 +313,7 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve

// 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);
Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/plasma/plasmaSearchQuery.java
Expand Up @@ -239,14 +239,14 @@ public String id() {
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;
}
Expand Down

0 comments on commit e90afa9

Please sign in to comment.