Views without a pager are now limited to 10 results, make the default rows parameter configurable

Created on 18 July 2019, over 5 years ago
Updated 30 June 2023, over 1 year ago

Problem/Motivation

Pagination / Number of items broken for MLT block introduced a bug in our feeds (they don't have a pager and are now limited to 10 items)

In SearchApiQuery 'limit' is set to NULL when there's no pager:

// Views passes sometimes NULL and sometimes the integer 0 for “All” in a
// pager. If set to 0 items, a string “0" is passed. Therefore, we unset
// the limit if an empty value OTHER than a string “0” was passed.
if (!$this->limit && $this->limit !== '0') {
  $this->limit = NULL;
}

Then in SearchApiSolrBackend.php rows is set to 10 if limit is NULL:

// In previous versions we set a high value for rows if no limit was set
// in the options. The intention was to retrieve "all" results instead of
// falling back to Solr's default of 10. But for Solr Cloud it turned out
// that independent from the real number of documents, Solr seems to
// allocate rows*shards memory for sorting the distributed result. That
// could lead to out of memory exceptions.
$solarium_query->setRows($query->getOption('limit', 10) ?? 10);

Proposed resolution

We should set a higher limit (e.g. 1000) but probably not too high to run into memory issues?

See https://github.com/mkalkbrenner/search_api_solr/pull/43

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇧🇪Belgium mpp

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024