Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-15902

Out of range error with Sphinx search

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.2.4
    • 3.2.9-RC1, 3.3.0
    • Search
    • PHP 7.2.12, MariaDB 10.1.34

    Description

      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?

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: