mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 03:48:53 +00:00
[ticket/17365] Include $countable_keywords with spaces before -, + and |
This reverses the previous commit and tries a different approach which may be more friendly to the tests
This commit is contained in:
parent
f03453c063
commit
e9c08a1689
1 changed files with 5 additions and 3 deletions
|
@ -289,7 +289,6 @@ class fulltext_native extends \phpbb\search\base
|
|||
'#(\+|\-)(?:\+|\-)+#',
|
||||
'#\(\|#',
|
||||
'#\|\)#',
|
||||
'#(?<!\s)(\+|\-|\|)#',
|
||||
);
|
||||
$replace = array(
|
||||
' ',
|
||||
|
@ -297,11 +296,14 @@ class fulltext_native extends \phpbb\search\base
|
|||
'$1',
|
||||
'(',
|
||||
')',
|
||||
' $1',
|
||||
);
|
||||
|
||||
$keywords = preg_replace($match, $replace, $keywords);
|
||||
$num_keywords = count(explode(' ', $keywords));
|
||||
|
||||
// Ensure a space exists before +, - and | to make the split and count work correctly
|
||||
$countable_keywords = preg_replace('/(?<!\s)(\+|\-|\|)/', ' $1', $keywords);
|
||||
|
||||
$num_keywords = count(explode(' ', $countable_keywords));
|
||||
|
||||
// We limit the number of allowed keywords to minimize load on the database
|
||||
if ($this->config['max_num_search_keywords'] && $num_keywords > $this->config['max_num_search_keywords'])
|
||||
|
|
Loading…
Add table
Reference in a new issue