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

fulltext_mysql.php overreacts on + and - characters in search words

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.0.7-PL1
    • 3.0.8-RC1
    • Search
    • None
    • PHP 5.3.1, MySQL 5.1.41, Opera 10.60 / Firefox 3.0.5

    Description

      (using MySQL fulltext search)

      Currently it's impossible to search for a phrase like "Anna-Sophie" since phpBB always interprets the minus character as a boolean NOT, despite the fact it's enclosed in quotation marks. Then you are tempted to adjust your search term into "Anna Sophie" but this also finds texts like Anna Maria Sophie because phpBB prepends these with pluses which is not wanted at all.

      The culprit is in function split_keywords() of fulltext_mysql.php:

      $match		= array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#\+#', '#-#', '#\|#');


      ...which could be slightly more sensible to only convert characters if they are the first character or following a whitespace:

      $match		= array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#(^|\s)\+#', '#(^|\s)-#', '#(^|\s)\|#');

      With this modification everybody can finally do searches like "Anna-Sophie" and even "Blank+Jones".

      Attachments

        Issue Links

          Activity

            People

              A_Jelly_Doughnut A_Jelly_Doughnut
              AmigoJack AmigoJack
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: