Skip to content

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

show progress of search after display of results is finished

orbiterfcd4b03892c9
diff --git a/htroot/js/yacysearch.js b/htroot/js/yacysearch.js
index 67eeabc3e..c2097453e 100644
--- a/htroot/js/yacysearch.js
+++ b/htroot/js/yacysearch.js
@@ -71,8 +71,8 @@ function addHover() {
}
function statistics(offset, itemscount, totalcount, localResourceSize, remoteResourceSize, remoteIndexCount, remotePeerCount) {
- document.getElementById("resultsOffset").firstChild.nodeValue = offset;
- document.getElementById("itemscount").firstChild.nodeValue = itemscount;
+ if (offset >= 0) document.getElementById("resultsOffset").firstChild.nodeValue = offset;
+ if (itemscount >= 0) document.getElementById("itemscount").firstChild.nodeValue = itemscount;
document.getElementById("totalcount").firstChild.nodeValue = totalcount;
if (document.getElementById("localResourceSize") == null) return;
document.getElementById("localResourceSize").firstChild.nodeValue = localResourceSize;
diff --git a/htroot/opensearchdescription.java b/htroot/opensearchdescription.java
index 50c2fa90e..b73232bc0 100644
--- a/htroot/opensearchdescription.java
+++ b/htroot/opensearchdescription.java
@@ -39,7 +39,7 @@ public class opensearchdescription {
String promoteSearchPageGreeting = env.getConfig(SwitchboardConstants.GREETING, "");
if (env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
- String thisaddress = header.get("Host", "localhost");
+ String thisaddress = header.get("Host", "127.0.0.1");
if (thisaddress.indexOf(':') == -1) thisaddress += ":" + serverCore.getPortNr(env.getConfig("port", "8090"));
int compareyacy = 0;
diff --git a/htroot/opensearchdescription.xml b/htroot/opensearchdescription.xml
index 9c0743211..8a5df5fe3 100644
--- a/htroot/opensearchdescription.xml
+++ b/htroot/opensearchdescription.xml
@@ -25,6 +25,6 @@
<Query role="example" searchTerms="yacy+open+source" />
<Tags>YaCy Open Source P2P Web Search</Tags>
<Contact>See http://#[thisaddress]#/ViewProfile.html?hash=localhash</Contact>
- <Attribution>YaCy Software &amp;copy; 2004-2010 by Michael Christen et al., YaCy.net; Content: ask peer owner</Attribution>
+ <Attribution>YaCy Software &amp;copy; 2004-2011 by Michael Christen et al., YaCy.net; Content: ask peer owner</Attribution>
<SyndicationRight>open</SyndicationRight>
</OpenSearchDescription>
diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html
index 87ecacc44..dd394f22b 100644
--- a/htroot/yacysearch.html
+++ b/htroot/yacysearch.html
@@ -213,5 +213,36 @@ var progressbar = new Progressbar(#[results]#, document.getElementById("results"
<!--#include virtual="yacysearchtrailer.html?eventID=#[eventID]#" -->
<!-- /div -->
</div>
+<!-- update the search results statistics after the search is finished -->
+<script type="text/javascript">
+
+function latestinfo() {
+ if (window.XMLHttpRequest) { // Mozilla/Safari
+ self.xmlHttpReq = new XMLHttpRequest();
+ } else if (window.ActiveXObject) { // IE
+ self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ self.xmlHttpReq.open('GET', "yacysearchlatestinfo.json?eventID=#[eventID]#", true);
+ self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ self.xmlHttpReq.onreadystatechange = function() {
+ if (self.xmlHttpReq.readyState == 4) {
+ var rsp = eval("(" + self.xmlHttpReq.responseText + ")");
+ statistics(rsp.offset, rsp.itemscount, rsp.totalcount, rsp.localResourceSize, rsp.remoteResourceSize, rsp.remoteIndexCount, rsp.remotePeerCount);
+ }
+ }
+ self.xmlHttpReq.send(null);
+}
+window.setTimeout('latestinfo();',500);
+window.setTimeout('latestinfo();',1000);
+window.setTimeout('latestinfo();',1500);
+window.setTimeout('latestinfo();',2000);
+window.setTimeout('latestinfo();',3000);
+window.setTimeout('latestinfo();',4000);
+window.setTimeout('latestinfo();',5000);
+window.setTimeout('latestinfo();',6000);
+window.setTimeout('latestinfo();',8000);
+window.setTimeout('latestinfo();',10000);
+</script>
+
</body>
</html>
\ No newline at end of file
diff --git a/htroot/yacysearchlatestinfo.java b/htroot/yacysearchlatestinfo.java
new file mode 100644
index 000000000..ca303b6cb
--- /dev/null
+++ b/htroot/yacysearchlatestinfo.java
@@ -0,0 +1,42 @@
+import net.yacy.cora.protocol.RequestHeader;
+import net.yacy.kelondro.util.Formatter;
+
+import de.anomic.search.QueryParams;
+import de.anomic.search.SearchEvent;
+import de.anomic.search.SearchEventCache;
+import de.anomic.server.serverObjects;
+import de.anomic.server.serverSwitch;
+
+
+public class yacysearchlatestinfo {
+
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final serverObjects prop = new serverObjects();
+ //Switchboard sb = (Switchboard) env;
+
+ // find search event
+ final String eventID = post.get("eventID", "");
+ final SearchEvent theSearch = SearchEventCache.getEvent(eventID);
+ if (theSearch == null) {
+ // the event does not exist, show empty page
+ return prop;
+ }
+ final QueryParams theQuery = theSearch.getQuery();
+ //if (sb.isGlobalMode() && !theQuery.isLocal()) try {Thread.sleep(1000);} catch (InterruptedException e) {}
+
+ // dynamically update count values
+ final int totalcount = theSearch.getRankingResult().getLocalIndexCount() - theSearch.getRankingResult().getMissCount() - theSearch.getRankingResult().getSortOutCount() + theSearch.getRankingResult().getRemoteIndexCount();
+ final int offset = theQuery.neededResults() - theQuery.displayResults() + 1;
+ prop.put("offset", offset);
+ prop.put("itemscount", -1);
+ prop.put("totalcount", Formatter.number(totalcount, true));
+ prop.put("localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalIndexCount(), true));
+ prop.put("localMissCount", Formatter.number(theSearch.getRankingResult().getMissCount(), true));
+ prop.put("remoteResourceSize", Formatter.number(theSearch.getRankingResult().getRemoteResourceSize(), true));
+ prop.put("remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true));
+ prop.put("remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true));
+
+ return prop;
+ }
+
+}
diff --git a/htroot/yacysearchlatestinfo.json b/htroot/yacysearchlatestinfo.json
new file mode 100644
index 000000000..50dc1460b
--- /dev/null
+++ b/htroot/yacysearchlatestinfo.json
@@ -0,0 +1,9 @@
+{
+"itemscount": "#[itemscount]#",
+"totalcount": "#[totalcount]#",
+"localResourceSize": "#[localResourceSize]#",
+"localMissCount": "#[localMissCount]#",
+"remoteResourceSize": "#[remoteResourceSize]#",
+"remoteIndexCount": "#[remoteIndexCount]#",
+"remotePeerCount": "#[remotePeerCount]#"
+}