[mod] add setting: search.autocomplete_min

Minimun characters to type before autocompleter starts.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2022-04-22 13:47:54 +02:00
parent ed2a4c8087
commit 444b1e70db
4 changed files with 5 additions and 1 deletions

View file

@ -18,6 +18,8 @@ search:
# "seznam", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off
# by default.
autocomplete: ""
# minimun characters to type before autocompleter starts
autocomplete_min: 4
# Default search language - leave blank to detect from browser information or
# use codes from 'languages.py'
default_lang: ""

View file

@ -153,6 +153,7 @@ SCHEMA = {
'search': {
'safe_search': SettingsValue((0, 1, 2), 0),
'autocomplete': SettingsValue(str, ''),
'autocomplete_min': SettingsValue(int, 4),
'default_lang': SettingsValue(tuple(LANGUAGE_CODES + ['']), ''),
'languages': SettingSublistValue(LANGUAGE_CODES, LANGUAGE_CODES),
'ban_time_on_fail': SettingsValue(numbers.Real, 5),

View file

@ -68,7 +68,7 @@
"Content-type": "application/x-www-form-urlencoded",
"X-Requested-With": "XMLHttpRequest"
},
MinChars: 4,
MinChars: searxng.settings.autocomplete_min,
Delay: 300,
_Position: function () {},
_Open: function () {

View file

@ -449,6 +449,7 @@ def get_client_settings():
req_pref = request.preferences
return {
'autocomplete_provider': req_pref.get_value('autocomplete'),
'autocomplete_min' : get_setting('search.autocomplete_min'),
'http_method': req_pref.get_value('method'),
'infinite_scroll': req_pref.get_value('infinite_scroll'),
'translations': get_translations(),