the affected file: administrator/components/com_finder/helpers/indexer/stemmer/snowball.php
public function stem($token, $lang)
{
// Language to use if All is specified.
static $defaultLang = '';
// If language is All then try to get site default language.
if ($lang == '*' && $defaultLang == '')
{
$languages = JLanguageHelper::getLanguages();
$defaultLang = isset($languages[0]->sef) ? $languages[0]->sef : '*';
$lang = $defaultLang;
}
// Stem the token if it is not in the cache.
if (!isset($this->cache[$lang][$token]))
{
// Get the stem function from the language string.
switch ($lang)
{
// Danish stemmer.
case 'da':
$function = 'stem_danish';
break;
// German stemmer.
case 'de':
$function = 'stem_german';
break;
// English stemmer.
default:
case 'en':
$function = 'stem_english';
break;
If the function parameter $lang
has the value '*' it should be changed to ```$defaultLang````
$lang
has the value '*'
independent of specific system, Joomla PHP code only
Normally -- if the language for an article ist not specified explicitly -- the language value i '*'
The first time the function stem
ist called, the $defaultLang
ist not defined and thus will correctly be initialized to the site's default language. $language
ist changed to $defaultLang
and the switch statement selects the correct stem_function.
The next time the function stem
ist called, $defaultLang
no longer hat the value '' and the if statement is skipped. $language
will keep ist's value '*' and the switch statement rund into it's default branch selecting stem_english.
Every further call of the function stem
uses stem_english regardless the site's default language.
// If language is All then try to use site default language.
if ($lang == '*')
{
if ($defaultLang == '')
{
// Try to get site default language.
$languages = JLanguageHelper::getLanguages();
$defaultLang = isset($languages[0]->sef) ? $languages[0]->sef : '*';
}
$lang = $defaultLang;
}
@StefanLindner I agree with your analysis of the problem and your suggested solution looks good. Can you submit a PR?
Closed_By | franz-wohlkoenig | ⇒ | joomla-cms-bot |
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-07-06 12:57:35 |
Closed_By | ⇒ | franz-wohlkoenig |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/16981
closed as having PR #17002
@chrisdavenport
Can you have a look ?
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16981.