mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge remote-tracking branch 'remotes/dhruvgoel92/ticket/10945-develop' into develop
* remotes/dhruvgoel92/ticket/10945-develop: [ticket/10945] Remove mark test incomplete for native search backend [ticket/10945] Fix Unit Tests as per new changes to split_keywords [ticket/10945] Remove mark test incomplete for mysql and postgres [ticket/10945] Fix return values for split_keywords function [ticket/10945] Display search query when search fails in native search [ticket/10945] remove trigger_error call
This commit is contained in:
commit
72e0fe0b22
6 changed files with 16 additions and 48 deletions
|
@ -325,7 +325,6 @@ class fulltext_native extends \phpbb\search\base
|
||||||
}
|
}
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
unset($exact_words);
|
|
||||||
|
|
||||||
// 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);
|
||||||
|
@ -451,23 +450,9 @@ class fulltext_native extends \phpbb\search\base
|
||||||
$this->{$mode . '_ids'}[] = $words[$word];
|
$this->{$mode . '_ids'}[] = $words[$word];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// throw an error if we shall not ignore unexistant words
|
else
|
||||||
else if (!$ignore_no_id)
|
|
||||||
{
|
{
|
||||||
if (!isset($common_ids[$word]))
|
if (!isset($common_ids[$word]))
|
||||||
{
|
|
||||||
$len = utf8_strlen($word);
|
|
||||||
if ($len >= $this->word_length['min'] && $len <= $this->word_length['max'])
|
|
||||||
{
|
|
||||||
trigger_error(sprintf($this->user->lang['WORD_IN_NO_POST'], $word));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->common_words[] = $word;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$len = utf8_strlen($word);
|
$len = utf8_strlen($word);
|
||||||
if ($len < $this->word_length['min'] || $len > $this->word_length['max'])
|
if ($len < $this->word_length['min'] || $len > $this->word_length['max'])
|
||||||
|
@ -476,14 +461,10 @@ class fulltext_native extends \phpbb\search\base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we can't search for negatives only
|
|
||||||
if (!sizeof($this->must_contain_ids))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->search_query))
|
// Return true if all words are not common words
|
||||||
|
if (sizeof($exact_words) - sizeof($this->common_words) > 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -518,6 +499,12 @@ class fulltext_native extends \phpbb\search\base
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we can't search for negatives only
|
||||||
|
if (empty($this->must_contain_ids))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$must_contain_ids = $this->must_contain_ids;
|
$must_contain_ids = $this->must_contain_ids;
|
||||||
$must_not_contain_ids = $this->must_not_contain_ids;
|
$must_not_contain_ids = $this->must_not_contain_ids;
|
||||||
$must_exclude_one_ids = $this->must_exclude_one_ids;
|
$must_exclude_one_ids = $this->must_exclude_one_ids;
|
||||||
|
|
|
@ -527,12 +527,6 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||||
$total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
|
$total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For some searches we need to print out the "no results" page directly to allow re-sorting/refining the search options.
|
|
||||||
if (!sizeof($id_ary) && !$search_id)
|
|
||||||
{
|
|
||||||
trigger_error('NO_SEARCH_RESULTS');
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql_where = '';
|
$sql_where = '';
|
||||||
|
|
||||||
if (sizeof($id_ary))
|
if (sizeof($id_ary))
|
||||||
|
|
|
@ -16,8 +16,4 @@ class phpbb_functional_search_mysql_test extends phpbb_functional_search_base
|
||||||
{
|
{
|
||||||
protected $search_backend = '\phpbb\search\fulltext_mysql';
|
protected $search_backend = '\phpbb\search\fulltext_mysql';
|
||||||
|
|
||||||
protected function assert_search_not_found($keywords)
|
|
||||||
{
|
|
||||||
$this->markTestIncomplete('MySQL search when fails doesn\'t show the search query');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,4 @@ require_once dirname(__FILE__) . '/base.php';
|
||||||
class phpbb_functional_search_native_test extends phpbb_functional_search_base
|
class phpbb_functional_search_native_test extends phpbb_functional_search_base
|
||||||
{
|
{
|
||||||
protected $search_backend = '\phpbb\search\fulltext_native';
|
protected $search_backend = '\phpbb\search\fulltext_native';
|
||||||
|
|
||||||
protected function assert_search_not_found($keywords)
|
|
||||||
{
|
|
||||||
$this->markTestIncomplete('Native search when fails doesn\'t show the search query');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,4 @@ class phpbb_functional_search_postgres_test extends phpbb_functional_search_base
|
||||||
{
|
{
|
||||||
protected $search_backend = '\phpbb\search\fulltext_postgres';
|
protected $search_backend = '\phpbb\search\fulltext_postgres';
|
||||||
|
|
||||||
protected function assert_search_not_found($keywords)
|
|
||||||
{
|
|
||||||
$this->markTestIncomplete('Postgres search when fails doesn\'t show the search query');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,17 +106,17 @@ class phpbb_search_native_test extends phpbb_search_test_case
|
||||||
array(
|
array(
|
||||||
'-foo',
|
'-foo',
|
||||||
'all',
|
'all',
|
||||||
false,
|
true,
|
||||||
null,
|
array(),
|
||||||
null,
|
array(1),
|
||||||
array(),
|
array(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'-foo -bar',
|
'-foo -bar',
|
||||||
'all',
|
'all',
|
||||||
false,
|
true,
|
||||||
null,
|
array(),
|
||||||
null,
|
array(1, 2),
|
||||||
array(),
|
array(),
|
||||||
),
|
),
|
||||||
// all common
|
// all common
|
||||||
|
|
Loading…
Add table
Reference in a new issue