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)

see http://mantis.tokeek.de/view.php?id=627
pull/41/merge
reger 9 years ago
parent abd8ecb503
commit 4765e374e6

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

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

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

Loading…
Cancel
Save