Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
#cccamp11 maintenance fix: anons may find up to 1000 items in interactive search (was: 100)
orbiter594d8f546afd
diff --git a/htroot/js/yacyinteractive.js b/htroot/js/yacyinteractive.jsindex f1ad1b63f..583597f97 100644--- a/htroot/js/yacyinteractive.js+++ b/htroot/js/yacyinteractive.js@@ -2,12 +2,14 @@ function xmlhttpPost() {var searchform = document.forms['searchform'];var rsslink = document.getElementById("rsslink");if (rsslink != null) rsslink.href="yacysearch.rss?query=" + searchform.query.value;- search(searchform.query.value);+ search(searchform.query.value, searchform.maximumRecords.value, searchform.startRecord.value);}// static variablesvar start = new Date();var query = "";+var maximumRecords = "1000";+var startRecord = "0";var searchresult;var totalResults = 0;var filetypes;@@ -16,8 +18,12 @@ var script = "";var modifier = "";var modifiertype = "";-function search(search) {+function search(search, count, offset) {query = search;+ maximumRecords = count;+ if (count == "") maximumRecords = 1000;+ startRecord = offset;+ if (offset == "") startRecord = 0;start = new Date();if (query == null || query == "") {return;@@ -28,7 +34,7 @@ function search(search) {} else if (window.ActiveXObject) { // IEself.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");}- self.xmlHttpReq.open('GET', "yacysearch.json?verify=false&resource=local&maximumRecords=1000&nav=all&query=" + query, true);+ self.xmlHttpReq.open('GET', "yacysearch.json?verify=false&resource=local&nav=all&maximumRecords=" + maximumRecords + "&startRecord=" + startRecord + "&query=" + query, true);self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');self.xmlHttpReq.onreadystatechange = function() {if (self.xmlHttpReq.readyState == 4) {diff --git a/htroot/yacyinteractive.html b/htroot/yacyinteractive.htmlindex acc083978..462cc4909 100644--- a/htroot/yacyinteractive.html+++ b/htroot/yacyinteractive.html@@ -33,7 +33,9 @@<script type="text/javascript">//<![CDATA[var q = "#[query]#";-if (q != "") search(q);+var s = "#[startRecord]#";+var m = "#[maximumRecords]#";+if (q != "") search(q, m, s);//]]></script>#(topmenu)#@@ -60,6 +62,8 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de<a href="#[promoteSearchPageGreeting.homepage]#" class="yacylogo"><img src="#[promoteSearchPageGreeting.smallImage]#" alt="yacysearch"/></a></div><fieldset class="yacys">+ <input type="hidden" name="maximumRecords" value="#[maximumRecords]#" />+ <input type="hidden" name="startRecord" value="#[startRecord]#" /><input id="search" name="query" type="text" value="#[query]#" size="50" maxlength="80" /></fieldset><!--<pre>Raw JSON String: <div id="raw"></div></pre>-->diff --git a/htroot/yacyinteractive.java b/htroot/yacyinteractive.javaindex 116d5f2e4..3793a6062 100644--- a/htroot/yacyinteractive.java+++ b/htroot/yacyinteractive.java@@ -45,9 +45,13 @@ public class yacyinteractive {prop.put("promoteSearchPageGreeting", promoteSearchPageGreeting);prop.put("promoteSearchPageGreeting.homepage", sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));prop.put("promoteSearchPageGreeting.smallImage", sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));-+final String query = (post == null) ? "" : post.get("query", "");+ final String startRecord = (post == null) ? "0" : post.get("startRecord", "");+ final String maximumRecords = (post == null) ? "1000" : post.get("maximumRecords", "");prop.putHTML("query", query);+ prop.putHTML("startRecord", startRecord);+ prop.putHTML("maximumRecords", maximumRecords);prop.putHTML("querys", query.replaceAll(" ", "+"));return prop;}diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex c25266962..b8d9aa7c2 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -180,7 +180,7 @@ public class yacysearch {// collect search attributesfinal boolean newsearch =post.hasValue("query") && post.hasValue("former") && !post.get("query","").equalsIgnoreCase(post.get("former","")); //new search term- int itemsPerPage = Math.min((authenticated) ? (snippetFetchStrategy != null && snippetFetchStrategy.isAllowedToFetchOnline() ? 100 : 1000) : (snippetFetchStrategy != null && snippetFetchStrategy.isAllowedToFetchOnline() ? 20 : 500), post.getInt("maximumRecords", post.getInt("count", 10))); // SRU syntax with old property as alternative+ int itemsPerPage = Math.min((authenticated) ? (snippetFetchStrategy != null && snippetFetchStrategy.isAllowedToFetchOnline() ? 100 : 5000) : (snippetFetchStrategy != null && snippetFetchStrategy.isAllowedToFetchOnline() ? 20 : 1000), post.getInt("maximumRecords", post.getInt("count", 10))); // SRU syntax with old property as alternativeint offset = (newsearch) ? 0 : post.getInt("startRecord", post.getInt("offset", 0));final int newcount;diff --git a/source/de/anomic/search/QueryParams.java b/source/de/anomic/search/QueryParams.javaindex 941617e9b..b40195aa0 100644--- a/source/de/anomic/search/QueryParams.java+++ b/source/de/anomic/search/QueryParams.java@@ -196,8 +196,8 @@ public final class QueryParams {this.ranking = ranking;this.maxDistance = maxDistance;this.contentdom = contentdom;- this.itemsPerPage = Math.min((specialRights) ? 1000 : 100, itemsPerPage);- this.offset = Math.min((specialRights) ? 10000 : 1000, offset);+ this.itemsPerPage = Math.min((specialRights) ? 10000 : 1000, itemsPerPage);+ this.offset = Math.max(0, Math.min((specialRights) ? 10000 - this.itemsPerPage : 1000 - this.itemsPerPage, offset));try {this.urlMask = Pattern.compile(urlMask.toLowerCase());} catch (final PatternSyntaxException ex) {