Skip to content

Commit

Permalink
Smart Search common words assigned too much weight (#12450)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdavenport authored and Michael Babker committed Jan 8, 2018
1 parent 3d15331 commit f3db025
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions administrator/components/com_finder/helpers/indexer/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,21 @@ public static function addContentType($title, $mime = null)
public static function isCommon($token, $lang)
{
static $data;
static $default;

$langCode = $lang;

// If language requested is wildcard, use the default language.
if ($lang == '*')
{
$default = $default === null ? substr(self::getDefaultLanguage(), 0, 2) : $default;
$langCode = $default;
}

// Load the common tokens for the language if necessary.
if (!isset($data[$lang]))
if (!isset($data[$langCode]))
{
$data[$lang] = self::getCommonWords($lang);
$data[$langCode] = self::getCommonWords($langCode);
}

// Check if the token is in the common array.
Expand Down

0 comments on commit f3db025

Please sign in to comment.