aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/search
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2014-03-09 11:15:48 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2014-03-09 11:15:48 -0500
commit72e0fe0b22c6a020293d49d2aa8562130b59a5a0 (patch)
tree7f19152f8b071f51898d999e64a98b9fc9738d52 /phpBB/phpbb/search
parentc305bd25e469e6cb8a0983d9ba0f36252b4c62ab (diff)
parent0036b00fc476cdc9c3c83899da98370c18b339b3 (diff)
downloadforums-72e0fe0b22c6a020293d49d2aa8562130b59a5a0.tar
forums-72e0fe0b22c6a020293d49d2aa8562130b59a5a0.tar.gz
forums-72e0fe0b22c6a020293d49d2aa8562130b59a5a0.tar.bz2
forums-72e0fe0b22c6a020293d49d2aa8562130b59a5a0.tar.xz
forums-72e0fe0b22c6a020293d49d2aa8562130b59a5a0.zip
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
Diffstat (limited to 'phpBB/phpbb/search')
-rw-r--r--phpBB/phpbb/search/fulltext_native.php33
1 files changed, 10 insertions, 23 deletions
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index 1a89182978..fb3726c957 100644
--- a/phpBB/phpbb/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -325,7 +325,6 @@ class fulltext_native extends \phpbb\search\base
}
$this->db->sql_freeresult($result);
}
- unset($exact_words);
// now analyse the search query, first split it using the spaces
$query = explode(' ', $keywords);
@@ -451,39 +450,21 @@ class fulltext_native extends \phpbb\search\base
$this->{$mode . '_ids'}[] = $words[$word];
}
}
- // throw an error if we shall not ignore unexistant words
- else if (!$ignore_no_id)
+ else
{
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
+ if ($len < $this->word_length['min'] || $len > $this->word_length['max'])
{
$this->common_words[] = $word;
}
}
}
- else
- {
- $len = utf8_strlen($word);
- if ($len < $this->word_length['min'] || $len > $this->word_length['max'])
- {
- $this->common_words[] = $word;
- }
- }
}
- // 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;
}
@@ -518,6 +499,12 @@ class fulltext_native extends \phpbb\search\base
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;