Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-15902

Out of range error with Sphinx search

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.2.9-RC1, 3.3.0
    • 3.2.4
    • Search
    • 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:

      replace

      $this->sphinx->SetLimits((int) $start, (int) $per_page, SPHINX_MAX_MATCHES);

      with

      $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?

            Marc Marc
            Hunchman801 Hunchman801 [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: