XMLWordPrintable

Details

    • Sub-task
    • Status: Unverified Fix (View Workflow)
    • Minor
    • Resolution: Fixed
    • 3.2.0, 3.3.0-b2
    • 3.2.10-RC1, 3.3.1-RC1
    • Search
    • SphinxSearch v.2.2.11

    Description

      SphinxSearch allows for exact phrase searching through its extended query syntax, see: http://sphinxsearch.com/docs/current.html#extended-syntax

      With extended syntax mode enabled, a phrase search can be conducted by using double quotation marks around the relevant keywords, eg "hello world" will return results for the exact phrase hello world only and not "hello" AND "world".

      However, when searching for keyword in double quotation marks using the current implementation of SphinxSearch in phpBB 3.1.x to 3.3.x, this will return results containing each word within the string irrespective of position, ie it does not return exact phrases.

      Upon inspection of phpbb/search/fulltext_sphinx.php, it look as though it was intended to have exact phrase searching.  Note, in fulltext_sphinx.php:

      (a) when "all" search terms is selected, Extended Syntax is enabled by invoking SetMatchMode(SPH_MATCH_EXTENDED) (line 438 in current master version)

      (b) quotation marks from the user's search query are preserved and carried through to the Sphinx engine (see line 445 in current master version)

      (c) the query passed through to Sphinx uses the Sphinx PHP API EscapeString() function in what appears to be an attempt to preserve the double quotation marks. See eg lines 648, 656 in current master version. However I believe this is the exact opposite of what you want. The quotation marks need to pass through to Sphinx without escaping in order to preserve Sphinx Extended Syntax. EscapeString is telling Sphinx to search for a double quotation mark, not search for a phrase. See here: http://sphinxsearch.com/forum/view.html?id=5225

      Indeed, looking at the Sphinx query logs, a search for "hello world" in phpBB is queried through Sphinx as /"hello world /" whereas if the query "hello world" is used, this should return the exact phrase only. 

      By un-escaping queries with double quotation marks, there may an easy fix here to enabling exact phrase searching for Sphinx Fulltext.

       

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: