summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542>2011-08-11 21:37:35 +0000
committerorbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542>2011-08-11 21:37:35 +0000
commit594d8f546afdfdc1dd947c4e23dc4deba597eb69 (patch)
tree9380036f7d570131ebc2e95cf4e4695aa368a12b
parenteb14111200c2b95e190d4ff331056a18ebeee85e (diff)
#cccamp11 maintenance fix: anons may find up to 1000 items in interactive search (was: 100)
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7866 6c8d7289-2bf4-0310-a012-ef5d649a1542
-rw-r--r--htroot/js/yacyinteractive.js12
-rw-r--r--htroot/yacyinteractive.html6
-rw-r--r--htroot/yacyinteractive.java6
-rw-r--r--htroot/yacysearch.java2
-rw-r--r--source/de/anomic/search/QueryParams.java4
5 files changed, 22 insertions, 8 deletions
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 @@
<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.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) {