From 1efe607c34e0c88ac8827288c715e8d89a3ee4ee Mon Sep 17 00:00:00 2001
From: "(no author)" <(no author)@6c8d7289-2bf4-0310-a012-ef5d649a1542>
Date: Thu, 31 May 2007 11:24:59 +0000
Subject: [PATCH] git-svn-id:
https://svn.berlios.de/svnroot/repos/yacy/trunk@3771
6c8d7289-2bf4-0310-a012-ef5d649a1542
---
htroot/SearchStatistics_p.html | 4 +-
htroot/SearchStatistics_p.java | 15 +-
htroot/SearchStatistics_p.xml | 42 ++++
.../anomic/soap/services/SearchService.java | 40 ++++
source/de/anomic/soap/services/search.wsdl | 200 +++++++++++++-----
5 files changed, 246 insertions(+), 55 deletions(-)
create mode 100644 htroot/SearchStatistics_p.xml
diff --git a/htroot/SearchStatistics_p.html b/htroot/SearchStatistics_p.html
index 6cbbdf10e..baa1ba35e 100644
--- a/htroot/SearchStatistics_p.html
+++ b/htroot/SearchStatistics_p.html
@@ -63,7 +63,7 @@
#[host]# |
#[count]# |
- #[dates]# |
+ #{dates}##[date]# #{/dates}# |
#{/list}#
@@ -111,7 +111,7 @@
#[host]# |
#[peername]# |
#[count]# |
- #[dates]# |
+ #{dates}##[date]# #{/dates}# |
#{/list}#
diff --git a/htroot/SearchStatistics_p.java b/htroot/SearchStatistics_p.java
index bd2761261..1a0ba9114 100644
--- a/htroot/SearchStatistics_p.java
+++ b/htroot/SearchStatistics_p.java
@@ -67,6 +67,7 @@ public class SearchStatistics_p {
prop.put("page_list_" + entCount + "_dark", ((dark) ? 1 : 0) ); dark =! dark;
prop.put("page_list_" + entCount + "_host", (String) searchProfile.get("host"));
prop.put("page_list_" + entCount + "_date", yacyCore.universalDateShortString(new Date(trackerHandle.longValue())));
+ prop.put("page_list_" + entCount + "_timestamp", Long.toString(trackerHandle.longValue()));
if (page == 1) {
// local search
prop.put("page_list_" + entCount + "_offset", ((Integer) searchProfile.get("offset")).toString());
@@ -87,7 +88,7 @@ public class SearchStatistics_p {
}
if ((page == 2) || (page == 4)) {
Iterator i = (page == 2) ? switchboard.localSearchTracker.entrySet().iterator() : switchboard.remoteSearchTracker.entrySet().iterator();
- String host, handlestring;
+ String host;
TreeSet handles;
int entCount = 0;
Map.Entry entry;
@@ -95,11 +96,17 @@ public class SearchStatistics_p {
entry = (Map.Entry) i.next();
host = (String) entry.getKey();
handles = (TreeSet) entry.getValue();
- handlestring = "";
+
+ int dateCount = 0;
Iterator ii = handles.iterator();
while (ii.hasNext()) {
- handlestring += yacyCore.universalDateShortString(new Date(((Long) ii.next()).longValue())) + " ";
+ Long timestamp = (Long) ii.next();
+ prop.put("page_list_" + entCount + "_dates_" + dateCount + "_date", yacyCore.universalDateShortString(new Date(timestamp.longValue())));
+ prop.put("page_list_" + entCount + "_dates_" + dateCount + "_timestamp", timestamp.toString());
+ dateCount++;
}
+ prop.put("page_list_" + entCount + "_dates", dateCount);
+
prop.put("page_list_" + entCount + "_dark", ((dark) ? 1 : 0) ); dark =! dark;
prop.put("page_list_" + entCount + "_host", host);
if (page == 4) {
@@ -107,7 +114,7 @@ public class SearchStatistics_p {
prop.put("page_list_" + entCount + "_peername", (remotepeer == null) ? "UNKNOWN" : remotepeer.getName());
}
prop.put("page_list_" + entCount + "_count", new Integer(handles.size()).toString());
- prop.put("page_list_" + entCount + "_dates", handlestring);
+
// next
entCount++;
}
diff --git a/htroot/SearchStatistics_p.xml b/htroot/SearchStatistics_p.xml
new file mode 100644
index 000000000..e4ced47c1
--- /dev/null
+++ b/htroot/SearchStatistics_p.xml
@@ -0,0 +1,42 @@
+
+
+#(page)#
+ ::
+ #{list}#
+ #[host]#
+ #[date]#
+ #[offset]#
+ #[querycount]#
+ #[resultcount]#
+ #[querytime]#
+ #[resulttime]#
+ #[querystring]#
+ #{/list}#
+
+ ::
+ #{list}#
+ #[host]#
+ #[count]#
+ #{dates}#
+ #[date]#
+ #{/dates}#
+ #{/list}#
+
+ ::
+ #{list}#
+ #[host]#
+ #[peername]#
+ #[date]#
+ #[querycount]#>
+ #[resultcount]#
+ #[querytime]#
+ #[resulttime]#
+ #[queryhashes]#
+ #{/list}#
+
+ ::
+ #{list}#
+ #{/list}#
+
+#(/page)#
+
\ No newline at end of file
diff --git a/source/de/anomic/soap/services/SearchService.java b/source/de/anomic/soap/services/SearchService.java
index 2bb0b283c..931c098f5 100644
--- a/source/de/anomic/soap/services/SearchService.java
+++ b/source/de/anomic/soap/services/SearchService.java
@@ -70,7 +70,15 @@ public class SearchService extends AbstractService
private static final String TEMPLATE_URLINFO = "ViewFile.soap";
private static final String TEMPLATE_SNIPPET = "xml/snippet.xml";
private static final String TEMPLATE_OPENSEARCH = "opensearchdescription.xml";
+ private static final String TEMPLATE_SEARCHSTATS = "SearchStatistics_p.html";
+ /* =====================================================================
+ * Constants needed to get search statistic info
+ * ===================================================================== */
+ private static final int SEARCHSTATS_LOCAL_SEARCH_LOG = 1;
+ private static final int SEARCHSTATS_LOCAL_SEARCH_TRACKER = 2;
+ private static final int SEARCHSTATS_REMOTE_SEARCH_LOG = 3;
+ private static final int SEARCHSTATS_REMOTE_SEARCH_TRACKER = 4;
/**
* Constructor of this class
@@ -302,5 +310,37 @@ public class SearchService extends AbstractService
// sending back the result to the client
return this.convertContentToXML(result);
}
+
+ private Document getSearchStatData(int page) throws Exception {
+ if (page < 1 || page > 4) throw new IllegalArgumentException("Illegal page number.");
+
+ // extracting the message context
+ extractMessageContext(AUTHENTICATION_NEEDED);
+
+ serverObjects post = new serverObjects();
+ post.put("page", Integer.toString(page));
+
+ // generating the template containing the network status information
+ byte[] result = this.serverContext.writeTemplate(TEMPLATE_SEARCHSTATS, post, this.requestHeader);
+
+ // sending back the result to the client
+ return this.convertContentToXML(result);
+ }
+
+ public Document getLocalSearchLog() throws Exception {
+ return this.getSearchStatData(SEARCHSTATS_LOCAL_SEARCH_LOG);
+ }
+
+ public Document getLocalSearchTracker() throws Exception {
+ return this.getSearchStatData(SEARCHSTATS_LOCAL_SEARCH_TRACKER);
+ }
+
+ public Document getRemoteSearchLog() throws Exception {
+ return this.getSearchStatData(SEARCHSTATS_REMOTE_SEARCH_LOG);
+ }
+
+ public Document getRemoteSearchTracker() throws Exception {
+ return this.getSearchStatData(SEARCHSTATS_REMOTE_SEARCH_TRACKER);
+ }
}
diff --git a/source/de/anomic/soap/services/search.wsdl b/source/de/anomic/soap/services/search.wsdl
index 6fd7cd4c1..2677c9ff9 100644
--- a/source/de/anomic/soap/services/search.wsdl
+++ b/source/de/anomic/soap/services/search.wsdl
@@ -1,76 +1,127 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
-
+
+
+
-
+
-
-
+
+
+
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
-
-
+
+
+
+
+
-
-
-
+
-
-
-
+
+
+
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -78,8 +129,28 @@ Built on Nov 16, 2004 (12:19:44 EST)-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -88,44 +159,75 @@ Built on Nov 16, 2004 (12:19:44 EST)-->
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
\ No newline at end of file