#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
pull/1/head
orbiter 14 years ago
parent eb14111200
commit 594d8f546a

@ -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) {

@ -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>-->

@ -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;
}

@ -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;

@ -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) {

Loading…
Cancel
Save