aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search/fulltext_native.php
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2014-03-09 11:15:10 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2014-03-09 11:15:10 -0500
commit00f8fe24d2641823f51990b30d5a3f84884a78a6 (patch)
treea9b559f8ee4216cfa961fb2d760271f4d90b0e24 /phpBB/includes/search/fulltext_native.php
parent9f4908f0f2896d60c348f4e52ef4a200a8404bd7 (diff)
parentc51dcbe6a0cd6e15456ac80b2bdfe13d94f27f07 (diff)
downloadforums-00f8fe24d2641823f51990b30d5a3f84884a78a6.tar
forums-00f8fe24d2641823f51990b30d5a3f84884a78a6.tar.gz
forums-00f8fe24d2641823f51990b30d5a3f84884a78a6.tar.bz2
forums-00f8fe24d2641823f51990b30d5a3f84884a78a6.tar.xz
forums-00f8fe24d2641823f51990b30d5a3f84884a78a6.zip
Merge remote-tracking branch 'remotes/dhruvgoel92/ticket/10945' into develop-olympus
* remotes/dhruvgoel92/ticket/10945: [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/includes/search/fulltext_native.php')
-rw-r--r--phpBB/includes/search/fulltext_native.php33
1 files changed, 10 insertions, 23 deletions
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index dc961f3c8a..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);
@@ -357,39 +356,21 @@ 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)
+ else
{
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
+ 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;
}
@@ -428,6 +409,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;