mirror of https://github.com/searxng/searxng.git
[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:
parent
ed2a4c8087
commit
444b1e70db
|
@ -18,6 +18,8 @@ search:
|
||||||
# "seznam", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off
|
# "seznam", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off
|
||||||
# by default.
|
# by default.
|
||||||
autocomplete: ""
|
autocomplete: ""
|
||||||
|
# minimun characters to type before autocompleter starts
|
||||||
|
autocomplete_min: 4
|
||||||
# Default search language - leave blank to detect from browser information or
|
# Default search language - leave blank to detect from browser information or
|
||||||
# use codes from 'languages.py'
|
# use codes from 'languages.py'
|
||||||
default_lang: ""
|
default_lang: ""
|
||||||
|
|
|
@ -153,6 +153,7 @@ SCHEMA = {
|
||||||
'search': {
|
'search': {
|
||||||
'safe_search': SettingsValue((0, 1, 2), 0),
|
'safe_search': SettingsValue((0, 1, 2), 0),
|
||||||
'autocomplete': SettingsValue(str, ''),
|
'autocomplete': SettingsValue(str, ''),
|
||||||
|
'autocomplete_min': SettingsValue(int, 4),
|
||||||
'default_lang': SettingsValue(tuple(LANGUAGE_CODES + ['']), ''),
|
'default_lang': SettingsValue(tuple(LANGUAGE_CODES + ['']), ''),
|
||||||
'languages': SettingSublistValue(LANGUAGE_CODES, LANGUAGE_CODES),
|
'languages': SettingSublistValue(LANGUAGE_CODES, LANGUAGE_CODES),
|
||||||
'ban_time_on_fail': SettingsValue(numbers.Real, 5),
|
'ban_time_on_fail': SettingsValue(numbers.Real, 5),
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
"Content-type": "application/x-www-form-urlencoded",
|
"Content-type": "application/x-www-form-urlencoded",
|
||||||
"X-Requested-With": "XMLHttpRequest"
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
},
|
},
|
||||||
MinChars: 4,
|
MinChars: searxng.settings.autocomplete_min,
|
||||||
Delay: 300,
|
Delay: 300,
|
||||||
_Position: function () {},
|
_Position: function () {},
|
||||||
_Open: function () {
|
_Open: function () {
|
||||||
|
|
|
@ -449,6 +449,7 @@ def get_client_settings():
|
||||||
req_pref = request.preferences
|
req_pref = request.preferences
|
||||||
return {
|
return {
|
||||||
'autocomplete_provider': req_pref.get_value('autocomplete'),
|
'autocomplete_provider': req_pref.get_value('autocomplete'),
|
||||||
|
'autocomplete_min' : get_setting('search.autocomplete_min'),
|
||||||
'http_method': req_pref.get_value('method'),
|
'http_method': req_pref.get_value('method'),
|
||||||
'infinite_scroll': req_pref.get_value('infinite_scroll'),
|
'infinite_scroll': req_pref.get_value('infinite_scroll'),
|
||||||
'translations': get_translations(),
|
'translations': get_translations(),
|
||||||
|
|
Loading…
Reference in New Issue