Skip to content

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

fixed bugs in seach statistics

orbiter76fab8339587
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; [email protected], 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;
}
}