From 76fab83395875b918ed6301f219ccedd86fc1a0e Mon Sep 17 00:00:00 2001 From: orbiter Date: Thu, 18 Jan 2007 00:26:16 +0000 Subject: [PATCH] fixed bugs in seach statistics git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3240 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/SearchStatistics_p.java | 4 +-- htroot/ViewFile.java | 1 - htroot/yacy/search.java | 9 ++---- .../de/anomic/plasma/plasmaSearchEvent.java | 30 +++++++++---------- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/htroot/SearchStatistics_p.java b/htroot/SearchStatistics_p.java index 32b3bc029..9b990cdee 100644 --- a/htroot/SearchStatistics_p.java +++ b/htroot/SearchStatistics_p.java @@ -1,4 +1,4 @@ -// SearchStatisticsLocal_p.java +// SearchStatistics_p.java // (C) 2006 by Michael Peter Christen; mc@anomic.de, Frankfurt a. M., Germany // first published 14.01.2007 on http://www.anomic.de // @@ -73,7 +73,7 @@ public class SearchStatistics_p { if (page <= 2) { prop.put("page_list_" + entCount + "_querywords", new String(a)); } else { - prop.put("page_list_" + entCount + "_queryhashes", plasmaSearchQuery.hashSet2hashString((Set) searchProfile.get("queryhashes"))); + prop.put("page_list_" + entCount + "_queryhashes", plasmaSearchQuery.anonymizedQueryHashes((Set) searchProfile.get("queryhashes"))); } prop.put("page_list_" + entCount + "_querycount", ((Integer) searchProfile.get("querycount")).toString()); prop.put("page_list_" + entCount + "_querytime", ((Long) searchProfile.get("querytime")).toString()); diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java index f2c5163ec..0a95a7ba7 100644 --- a/htroot/ViewFile.java +++ b/htroot/ViewFile.java @@ -49,7 +49,6 @@ import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URLDecoder; -import java.net.URLEncoder; import java.util.Iterator; import java.util.Map; import java.util.TreeSet; diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java index 9bd75c040..0250a9b2a 100644 --- a/htroot/yacy/search.java +++ b/htroot/yacy/search.java @@ -126,12 +126,7 @@ public final class search { // prepare search final Set keyhashes = plasmaSearchQuery.hashes2Set(query); final long timestamp = System.currentTimeMillis(); - - serverObjects prop = new serverObjects(); - - long timestamp1 = System.currentTimeMillis(); - // prepare an abstract result StringBuffer indexabstract = new StringBuffer(); @@ -248,6 +243,8 @@ public final class search { // prepare search statistics Long trackerHandle = new Long(System.currentTimeMillis()); HashMap searchProfile = theSearch.resultProfile(); + searchProfile.put("resulttime", new Long(System.currentTimeMillis() - timestamp)); + searchProfile.put("resultcount", new Integer(joincount)); String client = (String) header.get("CLIENTIP"); searchProfile.put("host", client); sb.remoteSearches.put(trackerHandle, searchProfile); @@ -305,7 +302,7 @@ public final class search { prop.putASIS("fwrec", ""); // peers that would have helped to construct this result (recommendations) // log - yacyCore.log.logInfo("EXIT HASH SEARCH: " + plasmaSearchQuery.anonymizedQueryHashes(squery.queryHashes) + " - " + joincount + " links found, " + prop.get("linkcount", "?") + " links selected, " + ((System.currentTimeMillis() - timestamp1) / 1000) + " seconds"); + yacyCore.log.logInfo("EXIT HASH SEARCH: " + plasmaSearchQuery.anonymizedQueryHashes(squery.queryHashes) + " - " + joincount + " links found, " + prop.get("linkcount", "?") + " links selected, " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds"); prop.putASIS("searchtime", Long.toString(System.currentTimeMillis() - timestamp)); diff --git a/source/de/anomic/plasma/plasmaSearchEvent.java b/source/de/anomic/plasma/plasmaSearchEvent.java index 89b4f106c..b4934ba31 100644 --- a/source/de/anomic/plasma/plasmaSearchEvent.java +++ b/source/de/anomic/plasma/plasmaSearchEvent.java @@ -140,6 +140,7 @@ public final class plasmaSearchEvent extends Thread implements Runnable { // so all search tasks are queued synchronized (flushThreads) { long start = System.currentTimeMillis(); + plasmaSearchResult result; if (query.domType == plasmaSearchQuery.SEARCHDOM_GLOBALDHT) { int fetchpeers = (int) (query.maximumTime / 500L); // number of target peers; means 10 peers in 10 seconds if (fetchpeers > 50) fetchpeers = 50; @@ -208,33 +209,30 @@ public final class plasmaSearchEvent extends Thread implements Runnable { log.logFine("SEARCH TIME AFTER GLOBAL-TRIGGER TO " + fetchpeers + " PEERS: " + ((System.currentTimeMillis() - start) / 1000) + " seconds"); // combine the result and order - plasmaSearchResult result = orderFinal(rcLocal); + result = orderFinal(rcLocal); if (result != null) { result.globalContributions = globalContributions; // flush results in a separate thread this.start(); // start to flush results } - - // return search result - log.logFine("SEARCHRESULT: " + profileLocal.reportToString()); - lastEvent = this; - this.searchtime = System.currentTimeMillis() - start; - this.searchcount = result.filteredResults; - return result; } else { Map searchContainerMap = localSearchContainers(null); indexContainer rcLocal = (searchContainerMap == null) ? wordIndex.emptyContainer(null) : localSearchJoin(searchContainerMap.values()); - plasmaSearchResult result = orderFinal(rcLocal); + result = orderFinal(rcLocal); result.globalContributions = 0; - - // return search result - log.logFine("SEARCHRESULT: " + profileLocal.reportToString()); - lastEvent = this; - this.searchtime = System.currentTimeMillis() - start; - this.searchcount = result.filteredResults; - return result; } + + // log the event + log.logFine("SEARCHRESULT: " + profileLocal.reportToString()); + + // prepare values for statistics + lastEvent = this; + this.searchtime = System.currentTimeMillis() - start; + this.searchcount = result.filteredResults; + + // return search result + return result; } }