1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-14 05:36:30 +02:00

[feature/postgresql-fulltext-search] remove phrase search code

Unused Code for phrase search removed as pgsql doesnt support it. An added
message is displayed if user tries to perform exact phrase search.

PHPBB3-9730
This commit is contained in:
Dhruv Goel
2012-07-01 12:45:18 +05:30
parent f2dfaa73ff
commit 19d76f76dc
4 changed files with 13 additions and 33 deletions

View File

@ -30,6 +30,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
public $search_query;
public $common_words = array();
public $word_length = array();
public $phrase_search = false;
public function __construct(&$error)
{
@ -110,39 +111,6 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
preg_match_all('#(?:[^\p{L}\p{N}*"()]|^)([+\-|]?(?:[\p{L}\p{N}*"()]+\'?)*[\p{L}\p{N}*"()])(?:[^\p{L}\p{N}*"()]|$)#u', $split_keywords, $matches);
$this->split_words = $matches[1];
// to allow phrase search, we need to concatenate quoted words
$tmp_split_words = array();
$phrase = '';
foreach ($this->split_words as $word)
{
if ($phrase)
{
$phrase .= ' ' . $word;
if (strpos($word, '"') !== false && substr_count($word, '"') % 2 == 1)
{
$tmp_split_words[] = $phrase;
$phrase = '';
}
}
else if (strpos($word, '"') !== false && substr_count($word, '"') % 2 == 1)
{
$phrase = $word;
}
else
{
$tmp_split_words[] = $word . ' ';
}
}
if ($phrase)
{
$tmp_split_words[] = $phrase;
}
$this->split_words = $tmp_split_words;
unset($tmp_split_words);
unset($phrase);
foreach ($this->split_words as $i => $word)
{
$clean_word = preg_replace('#^[+\-|"]#', '', $word);