aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhruv <dhruv.goel92@gmail.com>2013-11-04 15:34:52 +0530
committerDhruv <dhruv.goel92@gmail.com>2014-03-08 21:20:37 +0530
commitb6eec5c142da665248a914ef2d47aad3f2367f4b (patch)
tree7b35115e53c92ad764c2d94be3c5f22da2053984
parentf4645a63762749b2c3d196c57db5a10cc93b04ca (diff)
downloadforums-b6eec5c142da665248a914ef2d47aad3f2367f4b.tar
forums-b6eec5c142da665248a914ef2d47aad3f2367f4b.tar.gz
forums-b6eec5c142da665248a914ef2d47aad3f2367f4b.tar.bz2
forums-b6eec5c142da665248a914ef2d47aad3f2367f4b.tar.xz
forums-b6eec5c142da665248a914ef2d47aad3f2367f4b.zip
[ticket/10945] Display search query when search fails in native search
If search fails and common words are present, split_keywords returns false and search.php file prints appropriate message of common words. If search fails and there are no common words, split_keywords returns true and keyword_search returns false so that the search query is displayed in search box. PHPBB3-10945
-rw-r--r--phpBB/includes/search/fulltext_native.php29
1 files changed, 11 insertions, 18 deletions
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index dc961f3c8a..5e116efebc 100644
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -357,22 +357,6 @@ class fulltext_native extends search_backend
$this->{$mode . '_ids'}[] = $words[$word];
}
}
- // throw an error if we shall not ignore unexistant words
- else if (!$ignore_no_id)
- {
- if (!isset($common_ids[$word]))
- {
- $len = utf8_strlen($word);
- if ($len >= $this->word_length['min'] && $len <= $this->word_length['max'])
- {
- trigger_error(sprintf($user->lang['WORD_IN_NO_POST'], $word));
- }
- else
- {
- $this->common_words[] = $word;
- }
- }
- }
else
{
$len = utf8_strlen($word);
@@ -383,8 +367,11 @@ class fulltext_native extends search_backend
}
}
- // we can't search for negatives only
- if (!sizeof($this->must_contain_ids))
+ // 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;
}
@@ -428,6 +415,12 @@ class fulltext_native extends search_backend
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_not_contain_ids = $this->must_not_contain_ids;
$must_exclude_one_ids = $this->must_exclude_one_ids;