phpBB

Code Changes

File: includes/search/fulltext_native.php

  Unmodified   Added   Modified   Removed
Line 204Line 204
		$this->search_query = $keywords;

$exact_words = array();

		$this->search_query = $keywords;

$exact_words = array();

		preg_match_all('#([^\\s+\\-|*()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words);

		preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words);

		$exact_words = $exact_words[1];

$common_ids = $words = array();

		$exact_words = $exact_words[1];

$common_ids = $words = array();

Line 231Line 231
			}
$db->sql_freeresult($result);
}

			}
$db->sql_freeresult($result);
}

		unset($exact_words);







// Handle +, - without preceeding whitespace character
$match = array('#(\S)\+#', '#(\S)-#');
$replace = array('$1 +', '$1 +');

$keywords = preg_replace($match, $replace, $keywords);


// now analyse the search query, first split it using the spaces
$query = explode(' ', $keywords);


// now analyse the search query, first split it using the spaces
$query = explode(' ', $keywords);

Line 357Line 362
					$this->{$mode . '_ids'}[] = $words[$word];
}
}

					$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]))

			{
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);
if ($len < $this->word_length['min'] || $len > $this->word_length['max'])

			{
$len = utf8_strlen($word);
if ($len < $this->word_length['min'] || $len > $this->word_length['max'])

Line 382Line 373
				}
}
}

				}
}
}


// 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;
}

		{
return true;
}

Line 424Line 411

// No keywords? No posts.
if (empty($this->search_query))


// No keywords? No posts.
if (empty($this->search_query))

 
		{
return false;
}

// we can't search for negatives only
if (empty($this->must_contain_ids))

		{
return false;
}

		{
return false;
}