Status: Closed (View Workflow)
PHP 7.2.12, MariaDB 10.1.34
Sphinx search uses the constant SPHINX_MAX_MATCHES (set to 20,000) to limit query results. This figure allows near-instant results, while performance is significantly impacted as it increases.
However there's quite a few situations where the limit won't be enough, e.g. searching for a user's first posts when they have over 20k.
A simple fix in this case is to keep the default 20,000 for all cases except when the offset exceeds it:
phpbb/search/fulltext_sphinx.php, lines 647 and 678:
$this->sphinx->SetLimits((int) $start, (int) $per_page, SPHINX_MAX_MATCHES);
$this->sphinx->SetLimits((int) $start, (int) $per_page, max(SPHINX_MAX_MATCHES, $start + $per_page));
This will leave performance unaffected for all search queries that currently work, and fix the out of range errors with the others.
Any thoughts on this?