use DEFAULT_SEARCH_LANGUAGE to generate tsvector index if per-feed language is not specified, also use it as default value on search form for convenience

master
Andrew Dolgov 6 years ago
parent 6768b3a4a3
commit c936cc3a1f

@ -733,7 +733,7 @@ class Feeds extends Handler_Protected {
if (DB_TYPE == "pgsql") {
print "<fieldset>";
print "<label class='inline'>" . __("Language:") . "</label>";
print_select("search_language", "", Pref_Feeds::get_ts_languages(),
print_select("search_language", get_pref('DEFAULT_SEARCH_LANGUAGE'), Pref_Feeds::get_ts_languages(),
"dojoType='dijit.form.Select' title=\"".__('Used for word stemming')."\"");
print "</fieldset>";
}

@ -28,6 +28,7 @@ class Pref_Prefs extends Handler_Protected {
__('Feeds') => [
'DEFAULT_UPDATE_INTERVAL',
'FRESH_ARTICLE_MAX_AGE',
'DEFAULT_SEARCH_LANGUAGE',
'BLOCK_SEPARATOR',
'ENABLE_FEED_CATS',
'BLOCK_SEPARATOR',
@ -68,6 +69,7 @@ class Pref_Prefs extends Handler_Protected {
$this->pref_help = [
"ALLOW_DUPLICATE_POSTS" => array(__("Allow duplicate articles"), ""),
"BLACKLISTED_TAGS" => array(__("Blacklisted tags"), __("Never apply these tags automatically (comma-separated list).")),
"DEFAULT_SEARCH_LANGUAGE" => array(__("Default language"), __("Used for full-text search")),
"CDM_AUTO_CATCHUP" => array(__("Mark read on scroll"), __("Mark articles as read as you scroll past them")),
"CDM_EXPANDED" => array(__("Always expand articles")),
"COMBINED_DISPLAY_MODE" => array(__("Combined mode"), __("Show flat list of articles instead of separate panels")),
@ -560,6 +562,10 @@ class Pref_Prefs extends Handler_Protected {
continue;
}
if ($pref_name == "DEFAULT_SEARCH_LANGUAGE" && DB_TYPE != "pgsql") {
continue;
}
if ($item = $prefs_available[$pref_name]) {
print "<fieldset class='prefs'>";
@ -613,6 +619,10 @@ class Pref_Prefs extends Handler_Protected {
print_select_hash($pref_name, $value, $update_intervals_nodefault,
'dojoType="dijit.form.Select"');
} else if ($pref_name == "DEFAULT_SEARCH_LANGUAGE") {
print_select($pref_name, $value, Pref_Feeds::get_ts_languages(),
'dojoType="dijit.form.Select"');
} else if ($type_name == "bool") {

@ -308,7 +308,12 @@ class RSSUtils {
$fetch_url = $row["feed_url"];
$feed_language = mb_strtolower($row["feed_language"]);
if (!$feed_language) $feed_language = 'english';
if (!$feed_language)
$feed_language = mb_strtolower(get_pref('DEFAULT_SEARCH_LANGUAGE', $owner_uid));
if (!$feed_language)
$feed_language = 'simple';
} else {
return false;

Loading…
Cancel
Save