Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed page navigation counter
orbiter5b2e68b60de1
diff --git a/htroot/js/yacysearch.js b/htroot/js/yacysearch.jsindex 270f387f8..0e71bacf3 100644--- a/htroot/js/yacysearch.js+++ b/htroot/js/yacysearch.js@@ -80,46 +80,45 @@ function statistics(offset, itemscount, itemsperpage, totalcount, localResourceSdocument.getElementById("remoteResourceSize").firstChild.nodeValue = remoteResourceSize;document.getElementById("remoteIndexCount").firstChild.nodeValue = remoteIndexCount;document.getElementById("remotePeerCount").firstChild.nodeValue = remotePeerCount;-- var resNav = document.getElementById("resNav");- resNav.firstChild.nodeValue = "X";+ document.getElementById("resNav").firstChild.nodeValue = "X";// compose page navigationresnav = "";- thispage = offset / itemsperpage;- if (thispage == 0) {- resnav += ("<img src=\"env/grafics/navdl.gif\" alt=\"arrowleft\" width=\"16\" height=\"16\" /> ");- } else {- resnav += ("<a id=\"prevpage\" href=\"");- resnav += (navurlbase + "&startRecord=" + ((thispage - 1) * itemsperpage));- resnav += ("\"><img src=\"env/grafics/navdl.gif\" alt=\"arrowleft\" width=\"16\" height=\"16\" /></a> ");- }- numberofpages = Math.min(10, 1 + (((localResourceSize + remoteResourceSize) - 1) / itemsperpage));-- for (i = 0; i < numberofpages; i++) {- if (i == thispage) {- resnav += "<img src=\"env/grafics/navs";- resnav += (i + 1);- resnav += (".gif\" alt=\"page");- resnav += (i + 1);- resnav += ("\" width=\"16\" height=\"16\" /> ");- } else {- resnav += ("<a href=\"");- resnav += (navurlbase + "&startRecord=" + (i * itemsperpage));- resnav += ("\"><img src=\"env/grafics/navd");- resnav += (i + 1);- resnav += (".gif\" alt=\"page");- resnav += (i + 1);- resnav += ("\" width=\"16\" height=\"16\" /></a> ");- }- }- if (thispage >= numberofpages) {- resnav += ("<img src=\"env/grafics/navdr.gif\" alt=\"arrowright\" width=\"16\" height=\"16\" />");- } else {- resnav += ("<a id=\"nextpage\" href=\"");- resnav += (navurlbase + "&startRecord=" + ((thispage + 1) * itemsperpage));- resnav += ("\"><img src=\"env/grafics/navdr.gif\" alt=\"arrowright\" width=\"16\" height=\"16\" /></a>");- }+ thispage = Math.floor(offset / itemsperpage);+ if (thispage == 0) {+ resnav += ("<img src=\"env/grafics/navdl.gif\" alt=\"arrowleft\" width=\"16\" height=\"16\" /> ");+ } else {+ resnav += ("<a id=\"prevpage\" href=\"");+ resnav += (navurlbase + "&startRecord=" + ((thispage - 1) * itemsperpage));+ resnav += ("\"><img src=\"env/grafics/navdl.gif\" alt=\"arrowleft\" width=\"16\" height=\"16\" /></a> ");+ }- //document.getElementById("resNav").firstChild.nodeValue = resnav;+ numberofpages = Math.min(10, 1 + ((totalcount - 1) / itemsperpage));+ if (!numberofpages) numberofpages = 10;+ for (i = 0; i < numberofpages; i++) {+ if (i == thispage) {+ resnav += "<img src=\"env/grafics/navs";+ resnav += (i + 1);+ resnav += (".gif\" alt=\"page");+ resnav += (i + 1);+ resnav += ("\" width=\"16\" height=\"16\" /> ");+ } else {+ resnav += ("<a href=\"");+ resnav += (navurlbase + "&startRecord=" + (i * itemsperpage));+ resnav += ("\"><img src=\"env/grafics/navd");+ resnav += (i + 1);+ resnav += (".gif\" alt=\"page");+ resnav += (i + 1);+ resnav += ("\" width=\"16\" height=\"16\" /></a> ");+ }+ }+ if (thispage >= numberofpages) {+ resnav += ("<img src=\"env/grafics/navdr.gif\" alt=\"arrowright\" width=\"16\" height=\"16\" />");+ } else {+ resnav += ("<a id=\"nextpage\" href=\"");+ resnav += (navurlbase + "&startRecord=" + ((thispage + 1) * itemsperpage));+ resnav += ("\"><img src=\"env/grafics/navdr.gif\" alt=\"arrowright\" width=\"16\" height=\"16\" /></a>");+ }++ document.getElementById("resNav").innerHTML = resnav;}diff --git a/htroot/yacysearch.html b/htroot/yacysearch.htmlindex 308a39d20..3a76dcbb0 100644--- a/htroot/yacysearch.html+++ b/htroot/yacysearch.html@@ -234,7 +234,7 @@ function latestinfo() {self.xmlHttpReq.onreadystatechange = function() {if (self.xmlHttpReq.readyState == 4) {var rsp = eval("(" + self.xmlHttpReq.responseText + ")");- statistics(rsp.offset, rsp.itemscount, rsp.itemsperpage, rsp.totalcount, rsp.localResourceSize, rsp.remoteResourceSize, rsp.remoteIndexCount, rsp.remotePeerCount);+ statistics(rsp.offset, rsp.itemscount, rsp.itemsperpage, rsp.totalcount, rsp.localResourceSize, rsp.remoteResourceSize, rsp.remoteIndexCount, rsp.remotePeerCount, rsp.navurlBase);}}self.xmlHttpReq.send(null);diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex f6a5b82d2..d5a78374c 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -740,8 +740,8 @@ public class yacysearch {}final int indexcount = theSearch.getRankingResult().getLocalIndexCount() - theSearch.getRankingResult().getMissCount() - theSearch.getRankingResult().getSortOutCount() + theSearch.getRankingResult().getRemoteIndexCount();- prop.put("num-results_offset", offset);- prop.put("num-results_itemscount", Formatter.number(0, true));+ prop.put("num-results_offset", offset + 1);+ prop.put("num-results_itemscount", Formatter.number(offset + theSearch.getQuery().itemsPerPage > indexcount ? offset + indexcount % theSearch.getQuery().itemsPerPage : offset + theSearch.getQuery().itemsPerPage, true));prop.put("num-results_itemsPerPage", itemsPerPage);prop.put("num-results_totalcount", Formatter.number(indexcount, true));prop.put("num-results_globalresults", global && (indexReceiveGranted || clustersearch) ? "1" : "0");diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.htmlindex 87ed0b642..0b2ae0783 100644--- a/htroot/yacysearchitem.html+++ b/htroot/yacysearchitem.html@@ -56,7 +56,7 @@#(/content)#<script type="text/javascript">-statistics("#[offset]#", "#[itemscount]#", "#[itemsperpage]#", "#[totalcount]#", "#[localResourceSize]#", "#[remoteResourceSize]#", "#[remoteIndexCount]#", "#[remotePeerCount]#");+statistics("#[offset]#", "#[itemscount]#", "#[itemsperpage]#", "#[totalcount]#", "#[localResourceSize]#", "#[remoteResourceSize]#", "#[remoteIndexCount]#", "#[remotePeerCount]#", #[navurlBase]#);progressbar.step(1);</script>diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex c0608772f..dde0c94c5 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -101,6 +101,7 @@ public class yacysearchitem {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));+ prop.put("navurlBase", QueryParams.navurlBase("html", theQuery, null, theQuery.urlMask.toString(), theQuery.navigators).toString());final String target = sb.getConfig(SwitchboardConstants.SEARCH_TARGET, "_self");if (theQuery.contentdom == ContentDomain.TEXT) {diff --git a/htroot/yacysearchlatestinfo.java b/htroot/yacysearchlatestinfo.javaindex f4e818516..031f91892 100644--- a/htroot/yacysearchlatestinfo.java+++ b/htroot/yacysearchlatestinfo.java@@ -20,7 +20,7 @@ public class yacysearchlatestinfo {// the event does not exist.// to avoid missing patterns, we return dummy valuesprop.put("offset", 0);- prop.put("itemscount", -1);+ prop.put("itemscount", 0);prop.put("itemsperpage", 10);prop.put("totalcount", 0);prop.put("localResourceSize", 0);@@ -36,7 +36,7 @@ public class yacysearchlatestinfo {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("itemscount",Formatter.number(offset + theSearch.getQuery().itemsPerPage >= totalcount ? offset + totalcount % theSearch.getQuery().itemsPerPage - 1 : offset + theSearch.getQuery().itemsPerPage - 1));prop.put("itemsperpage", theSearch.getQuery().itemsPerPage);prop.put("totalcount", Formatter.number(totalcount, true));prop.put("localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalIndexCount(), true));@@ -44,6 +44,7 @@ public class yacysearchlatestinfo {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));+ prop.putJSON("navurlBase", QueryParams.navurlBase("html", theQuery, null, theQuery.urlMask.toString(), theQuery.navigators).toString());return prop;}diff --git a/htroot/yacysearchlatestinfo.json b/htroot/yacysearchlatestinfo.jsonindex b58401deb..6e00012ee 100644--- a/htroot/yacysearchlatestinfo.json+++ b/htroot/yacysearchlatestinfo.json@@ -1,4 +1,5 @@{+"offset": "#[offset]#","itemscount": "#[itemscount]#","itemsperpage": "#[itemsperpage]#","totalcount": "#[totalcount]#",@@ -6,5 +7,6 @@"localMissCount": "#[localMissCount]#","remoteResourceSize": "#[remoteResourceSize]#","remoteIndexCount": "#[remoteIndexCount]#",-"remotePeerCount": "#[remotePeerCount]#"+"remotePeerCount": "#[remotePeerCount]#",+"navurlBase": "#[navurlBase]#"}