function apachesolr_multilingual_confgen_get_stemmer in Apache Solr Multilingual 7
Same name and namespace in other branches
- 6.3 apachesolr_multilingual_confgen/apachesolr_multilingual_confgen.module \apachesolr_multilingual_confgen_get_stemmer()
Helper function that returns the name of a stemmer if available
Parameters
string: the language id
Return value
string the name of the stemmer
2 calls to apachesolr_multilingual_confgen_get_stemmer()
- apachesolr_multiligual_confgen_register_multilingual_variables in apachesolr_multilingual_confgen/
apachesolr_multilingual_confgen.module - apachesolr_multilingual_confgen_admin_form in apachesolr_multilingual_confgen/
apachesolr_multilingual_confgen.admin.inc - Implements hook_form().
File
- apachesolr_multilingual_confgen/
apachesolr_multilingual_confgen.module, line 93 - Multilingual search using Apache Solr.
Code
function apachesolr_multilingual_confgen_get_stemmer($language_id = NULL) {
static $available_stemmers = array(
'da' => 'Danish',
'nl' => 'Dutch',
'en' => 'English',
'fi' => 'Finnish',
'fr' => 'French',
'de' => 'German',
'it' => 'Italian',
'nn' => 'Norwegian',
'nb' => 'Norwegian',
'pt-br' => 'Portuguese',
'pt-pt' => 'Portuguese',
'ro' => 'Romanian',
'ru' => 'Russian',
'es' => 'Spanish',
'sv' => 'Swedish',
'tr' => 'Turkish',
);
if (is_null($language_id)) {
return $available_stemmers;
}
elseif (!is_string($language_id)) {
// Some language detection functions return FALSE in some cases.
// Instead of forcing everyone to not call this function in such a case
// we handle it gracefully here.
return '';
}
elseif (array_key_exists($language_id, $available_stemmers)) {
return $available_stemmers[$language_id];
}
else {
return '';
}
}