mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/16933] Consistent handling of hyphen by phpBB Native search backend
PHPBB3-16933
This commit is contained in:
parent
ec75f1741b
commit
d6a591cde3
2 changed files with 13 additions and 0 deletions
|
@ -253,6 +253,16 @@ class fulltext_native extends \phpbb\search\base
|
||||||
$keywords[$i] = ' ';
|
$keywords[$i] = ' ';
|
||||||
break;
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
|
// Ignore hyphen if followed by a space
|
||||||
|
if (isset($keywords[$i + 1]) && $keywords[$i + 1] == ' ')
|
||||||
|
{
|
||||||
|
$keywords[$i] = ' ';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$space = $keywords[$i];
|
||||||
|
}
|
||||||
|
break;
|
||||||
case '+':
|
case '+':
|
||||||
$space = $keywords[$i];
|
$space = $keywords[$i];
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -68,6 +68,9 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
||||||
$this->assert_search_found('phpbb3+installation', 1, 3);
|
$this->assert_search_found('phpbb3+installation', 1, 3);
|
||||||
$this->assert_search_found('foosubject+barsearch', 1, 2);
|
$this->assert_search_found('foosubject+barsearch', 1, 2);
|
||||||
$this->assert_search_not_found('loremipsumdedo');
|
$this->assert_search_not_found('loremipsumdedo');
|
||||||
|
$this->assert_search_found('barsearch-testing', 1, 2); // test hyphen ignored
|
||||||
|
$this->assert_search_found('barsearch+-+testing', 1, 2); // test hyphen wrapped with space ignored
|
||||||
|
$this->assert_search_not_found('barsearch+-testing'); // test excluding keyword
|
||||||
|
|
||||||
$this->login();
|
$this->login();
|
||||||
$this->admin_login();
|
$this->admin_login();
|
||||||
|
|
Loading…
Add table
Reference in a new issue