diff options
author | Dhruv <dhruv.goel92@gmail.com> | 2013-12-19 04:22:23 +0530 |
---|---|---|
committer | Dhruv <dhruv.goel92@gmail.com> | 2014-03-08 21:23:08 +0530 |
commit | c51dcbe6a0cd6e15456ac80b2bdfe13d94f27f07 (patch) | |
tree | a9b559f8ee4216cfa961fb2d760271f4d90b0e24 /phpBB/includes/search | |
parent | b6eec5c142da665248a914ef2d47aad3f2367f4b (diff) | |
download | forums-c51dcbe6a0cd6e15456ac80b2bdfe13d94f27f07.tar forums-c51dcbe6a0cd6e15456ac80b2bdfe13d94f27f07.tar.gz forums-c51dcbe6a0cd6e15456ac80b2bdfe13d94f27f07.tar.bz2 forums-c51dcbe6a0cd6e15456ac80b2bdfe13d94f27f07.tar.xz forums-c51dcbe6a0cd6e15456ac80b2bdfe13d94f27f07.zip |
[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
Diffstat (limited to 'phpBB/includes/search')
-rw-r--r-- | phpBB/includes/search/fulltext_native.php | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 5e116efebc..2ee119ccfe 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -231,7 +231,6 @@ class fulltext_native extends search_backend } $db->sql_freeresult($result); } - unset($exact_words); // now analyse the search query, first split it using the spaces $query = explode(' ', $keywords); @@ -359,24 +358,19 @@ class fulltext_native extends search_backend } else { - $len = utf8_strlen($word); - if ($len < $this->word_length['min'] || $len > $this->word_length['max']) + if (!isset($common_ids[$word])) { - $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 - // search.php will print out appropriate error message. - // 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 if all words are not common words + if (sizeof($exact_words) - sizeof($this->common_words) > 0) { return true; } |