mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
[ticket/10945] Fix return values for split_keywords function
The function now returns false if all the words are common words and true otherwise. PHPBB3-10945
This commit is contained in:
parent
b6eec5c142
commit
c51dcbe6a0
1 changed files with 8 additions and 14 deletions
|
@ -231,7 +231,6 @@ class fulltext_native extends search_backend
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$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);
|
||||||
|
@ -359,24 +358,19 @@ class fulltext_native extends search_backend
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$len = utf8_strlen($word);
|
if (!isset($common_ids[$word]))
|
||||||
if ($len < $this->word_length['min'] || $len > $this->word_length['max'])
|
|
||||||
{
|
{
|
||||||
$this->common_words[] = $word;
|
$len = utf8_strlen($word);
|
||||||
|
if ($len < $this->word_length['min'] || $len > $this->word_length['max'])
|
||||||
|
{
|
||||||
|
$this->common_words[] = $word;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If common words are present and no other search results then return false
|
// Return true if all words are not common words
|
||||||
// search.php will print out appropriate error message.
|
if (sizeof($exact_words) - sizeof($this->common_words) > 0)
|
||||||
// If both common words and search results are empty return true and keyword_search()
|
|
||||||
// later will return false for that condition
|
|
||||||
if (empty($this->must_contain_ids) && sizeof($this->common_words))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->search_query))
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue