diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2013-05-06 15:46:00 -0400 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2013-05-06 15:46:00 -0400 |
commit | 01eded7cc2b206cce593a389f09259c25e5107ff (patch) | |
tree | dae9ba02489fa129ab66825a1a8bcb37531fc09f | |
parent | ba01996e5aa180caebd196456b350969096124c7 (diff) | |
parent | bfdc6e19300da8fa62d8661fcbd92548a2d2cf97 (diff) | |
download | forums-01eded7cc2b206cce593a389f09259c25e5107ff.tar forums-01eded7cc2b206cce593a389f09259c25e5107ff.tar.gz forums-01eded7cc2b206cce593a389f09259c25e5107ff.tar.bz2 forums-01eded7cc2b206cce593a389f09259c25e5107ff.tar.xz forums-01eded7cc2b206cce593a389f09259c25e5107ff.zip |
Merge PR #1388 branch 'dhruvgoel92/ticket/11288' into develop
# By Dhruv
# Via Dhruv
* dhruvgoel92/ticket/11288:
[ticket/11288] fix regex in postgres
[ticket/11288] add search tests cases
-rw-r--r-- | phpBB/includes/search/fulltext_postgres.php | 2 | ||||
-rw-r--r-- | tests/search/common_test_case.php | 98 |
2 files changed, 99 insertions, 1 deletions
diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index eeb628b18f..5080587681 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -214,7 +214,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base { if ($terms == 'all') { - $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#\+#', '#-#', '#\|#'); + $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#(^|\s)\+#', '#(^|\s)-#', '#(^|\s)\|#'); $replace = array(' +', ' |', ' -', ' +', ' -', ' |'); $keywords = preg_replace($match, $replace, $keywords); diff --git a/tests/search/common_test_case.php b/tests/search/common_test_case.php index dd04f7048c..029637b00b 100644 --- a/tests/search/common_test_case.php +++ b/tests/search/common_test_case.php @@ -86,6 +86,104 @@ abstract class phpbb_search_common_test_case extends phpbb_search_test_case array('-fooo', '-baar'), array(), ), + array( + 'fooo -fooo', + 'all', + true, + array('fooo', '-fooo'), + array(), + ), + array( + 'fooo fooo-', + 'all', + true, + array('fooo', 'fooo'), + array(), + ), + array( + '-fooo fooo', + 'all', + true, + array('-fooo', 'fooo'), + array(), + ), + array( + 'fooo- fooo', + 'all', + true, + array('fooo', 'fooo'), + array(), + ), + array( + 'fooo-baar fooo', + 'all', + true, + array('fooo', 'baar', 'fooo'), + array(), + ), + array( + 'fooo-baar -fooo', + 'all', + true, + array('fooo', 'baar', '-fooo'), + array(), + ), + array( + 'fooo-baar fooo-', + 'all', + true, + array('fooo', 'baar', 'fooo'), + array(), + ), + array( + 'fooo-baar baar', + 'all', + true, + array('fooo', 'baar', 'baar'), + array(), + ), + array( + 'fooo-baar -baar', + 'all', + true, + array('fooo', 'baar', '-baar'), + array(), + ), + array( + 'fooo-baar baar-', + 'all', + true, + array('fooo', 'baar', 'baar'), + array(), + ), + array( + 'fooo-baar fooo-baar', + 'all', + true, + array('fooo', 'baar', 'fooo', 'baar'), + array(), + ), + array( + 'fooo-baar -fooo-baar', + 'all', + true, + array('fooo', 'baar', '-fooo', 'baar'), + array(), + ), + array( + 'fooo-baar fooo-baar-', + 'all', + true, + array('fooo', 'baar', 'fooo', 'baar'), + array(), + ), + array( + 'fooo-baar-baaz', + 'all', + true, + array('fooo', 'baar', 'baaz'), + array(), + ), ); } |