diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2022-04-22 13:47:54 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2022-05-07 17:58:30 +0200 |
commit | 444b1e70dbcfd258482b5ee258895593a0a2e42c (patch) | |
tree | 9aad1c9f74743697b6de8f50d592397c5cf6e7c9 | |
parent | ed2a4c80879d2d3741514ea1117ab672b8f55d54 (diff) | |
download | searxng-444b1e70dbcfd258482b5ee258895593a0a2e42c.tar.gz searxng-444b1e70dbcfd258482b5ee258895593a0a2e42c.zip |
[mod] add setting: search.autocomplete_min
Minimun characters to type before autocompleter starts.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r-- | searx/settings.yml | 2 | ||||
-rw-r--r-- | searx/settings_defaults.py | 1 | ||||
-rw-r--r-- | searx/static/themes/simple/src/js/main/search.js | 2 | ||||
-rwxr-xr-x | searx/webapp.py | 1 |
4 files changed, 5 insertions, 1 deletions
diff --git a/searx/settings.yml b/searx/settings.yml index 6e5556d0c..5aaf154df 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -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: "" diff --git a/searx/settings_defaults.py b/searx/settings_defaults.py index 7110fce93..938b9714d 100644 --- a/searx/settings_defaults.py +++ b/searx/settings_defaults.py @@ -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), diff --git a/searx/static/themes/simple/src/js/main/search.js b/searx/static/themes/simple/src/js/main/search.js index edd68d259..20e58e0fe 100644 --- a/searx/static/themes/simple/src/js/main/search.js +++ b/searx/static/themes/simple/src/js/main/search.js @@ -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 () { diff --git a/searx/webapp.py b/searx/webapp.py index b91e96df1..178500df6 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -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(), |