mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 05:38:52 +00:00
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/12933] Add test cases for * wildcard searches [ticket/12933] Handle case when * is last character of word
This commit is contained in:
commit
d7741cea60
3 changed files with 61 additions and 1 deletions
|
@ -303,7 +303,7 @@ class fulltext_native extends \phpbb\search\base
|
||||||
$this->search_query = $keywords;
|
$this->search_query = $keywords;
|
||||||
|
|
||||||
$exact_words = array();
|
$exact_words = array();
|
||||||
preg_match_all('#([^\\s+\\-|*()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words);
|
preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words);
|
||||||
$exact_words = $exact_words[1];
|
$exact_words = $exact_words[1];
|
||||||
|
|
||||||
$common_ids = $words = array();
|
$common_ids = $words = array();
|
||||||
|
|
|
@ -19,6 +19,11 @@
|
||||||
<value>commonword</value>
|
<value>commonword</value>
|
||||||
<value>commonword</value>
|
<value>commonword</value>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<value>baaz</value>
|
||||||
|
<value>baaz</value>
|
||||||
|
<value>baaz</value>
|
||||||
|
</row>
|
||||||
</table>
|
</table>
|
||||||
<table name="phpbb_search_wordlist">
|
<table name="phpbb_search_wordlist">
|
||||||
<column>word_id</column>
|
<column>word_id</column>
|
||||||
|
@ -39,5 +44,10 @@
|
||||||
<value>commonword</value>
|
<value>commonword</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<value>4</value>
|
||||||
|
<value>baaz</value>
|
||||||
|
<value>0</value>
|
||||||
|
</row>
|
||||||
</table>
|
</table>
|
||||||
</dataset>
|
</dataset>
|
||||||
|
|
|
@ -35,6 +35,8 @@ class phpbb_search_native_test extends phpbb_search_test_case
|
||||||
$this->db = $this->new_dbal();
|
$this->db = $this->new_dbal();
|
||||||
$error = null;
|
$error = null;
|
||||||
$class = self::get_search_wrapper('\phpbb\search\fulltext_native');
|
$class = self::get_search_wrapper('\phpbb\search\fulltext_native');
|
||||||
|
$config['fulltext_native_min_chars'] = 2;
|
||||||
|
$config['fulltext_native_max_chars'] = 14;
|
||||||
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user);
|
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +57,54 @@ class phpbb_search_native_test extends phpbb_search_test_case
|
||||||
array(),
|
array(),
|
||||||
array(),
|
array(),
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'baaz*',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array('\'baaz%\''),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'ba*az',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array('\'ba%az\''),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'ba*z',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array('\'ba%z\''),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'baa* baaz*',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array('\'baa%\'', '\'baaz%\''),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'ba*z baa*',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array('\'ba%z\'', '\'baa%\''),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'baaz* commonword',
|
||||||
|
'all',
|
||||||
|
true,
|
||||||
|
array('\'baaz%\''),
|
||||||
|
array(),
|
||||||
|
array('commonword'),
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'foo bar',
|
'foo bar',
|
||||||
'all',
|
'all',
|
||||||
|
|
Loading…
Add table
Reference in a new issue