mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge remote-tracking branch 'dhruvgoel92/ticket/11288-develop' into develop
* dhruvgoel92/ticket/11288-develop: [ticket/11288] Add unit test cases for foo-bar like queries [ticket/11288] Handle +,- without preceeding whitespace characters
This commit is contained in:
commit
4b259e3c82
2 changed files with 55 additions and 0 deletions
|
@ -326,6 +326,12 @@ class fulltext_native extends \phpbb\search\base
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle +, - without preceeding whitespace character
|
||||||
|
$match = array('#(\S)\+#', '#(\S)-#');
|
||||||
|
$replace = array('$1 +', '$1 +');
|
||||||
|
|
||||||
|
$keywords = preg_replace($match, $replace, $keywords);
|
||||||
|
|
||||||
// now analyse the search query, first split it using the spaces
|
// now analyse the search query, first split it using the spaces
|
||||||
$query = explode(' ', $keywords);
|
$query = explode(' ', $keywords);
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,55 @@ class phpbb_search_native_test extends phpbb_search_test_case
|
||||||
array(1, 2),
|
array(1, 2),
|
||||||
array(),
|
array(),
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'foo -foo',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array(1),
|
||||||
|
array(1),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'-foo foo',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array(1),
|
||||||
|
array(1),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
|
// some creative edge cases
|
||||||
|
array(
|
||||||
|
'foo foo-',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array(1),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'foo- foo',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array(1),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'foo-bar',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array(1, 2),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'foo-bar-foo',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array(1, 2),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
// all common
|
// all common
|
||||||
array(
|
array(
|
||||||
'commonword',
|
'commonword',
|
||||||
|
|
Loading…
Add table
Reference in a new issue