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

Out of range error with Sphinx search

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.2.4
    • Fix Version/s: None
    • Component/s: Search
    • Labels:
    • Environment:
      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

            • Assignee:
              Unassigned
              Reporter:
              Hunchman801 Hunchman801
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: