Skip to content

Commit

Permalink
[ticket/12986] Fix detection of common words in search
Browse files Browse the repository at this point in the history
$search->get_common_words() call goes before the split_keywords() call,
but $search->common_words array is being generated
within the function $search->split_keywords(). Thus, get_common_words()
returned an empty array instead of common words array.

PHPBB3-12986
  • Loading branch information
rxu committed Aug 16, 2014
1 parent 1dc2d0e commit 354d08d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions phpBB/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,11 @@
trigger_error($error);
}

$common_words = $search->get_common_words();

// let the search module split up the keywords
if ($keywords)
{
$correct_query = $search->split_keywords($keywords, $search_terms);
$common_words = $search->get_common_words();
if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id))
{
$ignored = (sizeof($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '<br />' : '';
Expand Down Expand Up @@ -599,7 +598,7 @@
'SEARCH_MATCHES' => $l_search_matches,
'SEARCH_WORDS' => $keywords,
'SEARCHED_QUERY' => $search->get_search_query(),
'IGNORED_WORDS' => (sizeof($common_words)) ? implode(' ', $common_words) : '',
'IGNORED_WORDS' => (!empty($common_words)) ? implode(' ', $common_words) : '',

'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled,

Expand Down

0 comments on commit 354d08d

Please sign in to comment.