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

Line 1334Line 1327
			$db->sql_query($sql);
}


			$db->sql_query($sql);
}


		$this->destroy_cache(array_unique($word_texts), $author_ids);

		$this->destroy_cache(array_unique($word_texts), array_unique($author_ids));

	}

/**

	}

/**

Line 1461Line 1454
	{
global $db;


	{
global $db;


		$sql = 'SELECT COUNT(*) as total_words
FROM ' . SEARCH_WORDLIST_TABLE;
$result = $db->sql_query($sql);
$this->stats['total_words'] = (int) $db->sql_fetchfield('total_words');
$db->sql_freeresult($result);

$sql = 'SELECT COUNT(*) as total_matches
FROM ' . SEARCH_WORDMATCH_TABLE;
$result = $db->sql_query($sql);
$this->stats['total_matches'] = (int) $db->sql_fetchfield('total_matches');
$db->sql_freeresult($result);

		$this->stats['total_words']		= $db->get_estimated_row_count(SEARCH_WORDLIST_TABLE);
$this->stats['total_matches'] = $db->get_estimated_row_count(SEARCH_WORDMATCH_TABLE);










	}

/**

	}

/**