Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

altered clac. of search result items per page to display taking the existing limits into account but make it consistent with search option screen for admin and public user changes: - configured default number of items per page (ConfigPortal_p.html) is used as is (no hardcoded limit) - otherwise requests are limited to 100 results per page ( = search option, index.html) (this basically is the major change, inc. limit from 20 to 100 for public user) P.S. - the older grant of more (1000), if no online snippet calculation, is kept (for the time being)

reger4765e374e65d
diff --git a/defaults/yacy.init b/defaults/yacy.init
index 2525beda4..d0da05d69 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -813,7 +813,7 @@ search.audio = false
search.video = false
search.app = false
-# number of search results displayed by default
+# number of search results per page displayed by default
search.items = 10
# target for search results; this is the href target attribute inside every search result link
diff --git a/htroot/ConfigPortal.html b/htroot/ConfigPortal.html
index 1533e47c4..516e4b07c 100644
--- a/htroot/ConfigPortal.html
+++ b/htroot/ConfigPortal.html
@@ -82,7 +82,7 @@
</dd>
<dt>Default maximum number of results per page</dt>
- <dd><input type="text" name="maximumRecords" value="#[maximumRecords]#" size="3" /> <small>max = 100 (with CACHEONLY=5000)</small></dd>
+ <dd><input type="text" name="maximumRecords" value="#[maximumRecords]#" size="3" /></dd>
<dt>Default index.html Page (by forwarder)</dt>
<dd><input type="text" name="indexForward" value="#[indexForward]#" size="60" /></dd>
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 8e29fc3e3..a5c87b63b 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -220,14 +220,15 @@ public class yacysearch {
// collect search attributes
- int itemsPerPage =
- Math.min(
- (authenticated)
- ? (snippetFetchStrategy != null && snippetFetchStrategy.isAllowedToFetchOnline()
- ? 100
- : 5000) : (snippetFetchStrategy != null
- && snippetFetchStrategy.isAllowedToFetchOnline() ? 20 : 1000),
- post.getInt("maximumRecords", post.getInt("count", post.getInt("rows", sb.getConfigInt(SwitchboardConstants.SEARCH_ITEMS, 10))))); // SRU syntax with old property as alternative
+ // check an determine items per page (max of [100 or configured default]}
+ final int defaultItemsPerPage = sb.getConfigInt(SwitchboardConstants.SEARCH_ITEMS, 10);
+ int itemsPerPage = post.getInt("maximumRecords", post.getInt("count", post.getInt("rows", defaultItemsPerPage))); // requested or default // SRU syntax with old property as alternative
+ // whatever admin has set as default, that's always ok
+ if (itemsPerPage > defaultItemsPerPage && itemsPerPage > 100) { // if above hardcoded 100 limit restrict request (except default allows more)
+ // search option (index.html) offers up to 100 (that defines the lower limit available to request)
+ itemsPerPage = Math.max((snippetFetchStrategy != null && snippetFetchStrategy.isAllowedToFetchOnline() ? 100 : 1000), defaultItemsPerPage);
+ }
+
int startRecord = post.getInt("startRecord", post.getInt("offset", post.getInt("start", 0)));
final boolean indexof = (post != null && post.get("indexof", "").equals("on"));