diff --git a/htroot/js/yacyinteractive.js b/htroot/js/yacyinteractive.js index 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 variables var 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) { // IE self.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.html index acc083978..462cc4909 100644 --- a/htroot/yacyinteractive.html +++ b/htroot/yacyinteractive.html @@ -33,7 +33,9 @@ #(topmenu)# @@ -60,6 +62,8 @@ To see a list of all APIs, please visit the
diff --git a/htroot/yacyinteractive.java b/htroot/yacyinteractive.java index 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.java index c25266962..b8d9aa7c2 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -180,7 +180,7 @@ public class yacysearch { // collect search attributes final 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 alternative int 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.java index 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) {