Commit graph

113 commits

Author SHA1 Message Date
Marc Abonce Seguin
51111c2594 [fix] always set langauge_aliases even if it's empty 2019-01-06 20:49:56 -06:00
Marc Abonce Seguin
772c048d01 refactor engine's search language handling
Add match_language function in utils to match any user given
language code with a list of engine's supported languages.

Also add language_aliases dict on each engine to translate
standard language codes into the custom codes used by the engine.
2018-03-27 00:08:03 -06:00
Adam Tauber
2f69eaeb2f [fix] fix engine initialization 2018-02-17 14:30:06 +01:00
Marc Abonce Seguin
829032f306 [fix] read utf-8 files (settings, languages, currency) with python3.5
Related to discussion in #1124
The io.open import is necessary for python2
2018-01-16 23:26:10 -06:00
Joseph Nuthalapati
bdc803e185
Make Python 3 able to read settings files with Unicode characters
SearX currently doesn't start up when run with Python 3 as it tries to parse the
settings.yml file with ASCII codecs.
There are similar problems with engines_languages.json and currencies.json
Python 3 requires that files with Unicode characters be read with a 'b' flag.
This also works with Python 2 and hence can be integrated into the main source
code.

Tested with the latest Python 3.6.4rc1 on Debian unstable.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2017-12-21 17:33:19 +05:30
Adam Tauber
0f6612bb40 [mod] separate engine load and initialization 2017-07-21 14:27:25 +02:00
Adam Tauber
1794f6a4d3 [enh] add "inactive" attribute to engines
This modification allows us to deactivate engines in settings.yml
without commenting them out
2017-07-20 13:32:20 +02:00
Adam Tauber
343ac7197d [fix] pep8 2017-06-06 23:37:42 +02:00
Adam Tauber
78365ffb8a [enh] add init function to engines which loads parallel 2017-06-06 22:20:20 +02:00
Adam Tauber
52e615dede [enh] py3 compatibility 2017-05-15 12:02:30 +02:00
Alexandre Flament
12d91c1d67 [mod] searx doesn't crash at startup when an engine can't be loaded (see #884) 2017-04-08 17:38:46 +02:00
Adam Tauber
8bff42f049 Merge branch 'master' into languages 2016-12-28 20:00:53 +01:00
Adam Tauber
ea034fafa9 [fix] proper engine init 2016-12-27 17:55:44 +01:00
Adam Tauber
a605377c40 [enh] explicit engine init 2016-12-27 17:31:14 +01:00
marc
af35eee10b tests for _fetch_supported_languages in engines
and refactor method to make it testable without making requests
2016-12-15 00:40:21 -06:00
marc
f62ce21f50 [mod] fetch supported languages for several engines
utils/fetch_languages.py gets languages supported by each engine and
generates engines_languages.json with each engine's supported language.
2016-12-13 19:58:10 -06:00
marc
149802c569 [enh] add supported_languages on engines and auto-generate languages.py 2016-12-13 19:32:00 -06:00
Alexandre Flament
e48f07a367 Merge branch 'master' into searchpy2 2016-12-09 23:11:45 +01:00
Adam Tauber
55dc538398 [mod] move load_module function to utils 2016-11-19 17:51:19 +01:00
Alexandre Flament
01e2648e93 Simplify search.py, basically updated PR #518
The timeouts in settings.yml is about the total time (not only the HTTP request but also the prepare the request and parsing the response)
It was more or less the case before since the threaded_requests function ignores the thread after the timeout even the HTTP request is ended.

New / changed stats :
* page_load_time : record the HTTP request time
* page_load_count: the number of HTTP request
* engine_time : the execution total time of an engine
* engine_time_count : the number of "engine_time" measure

The avg response times in the preferences are the engine response time (engine_load_time / engine_load_count)

To sum up :
* Search.search() filters the engines that can't process the request
* Search.search() call search_multiple_requests function
* search_multiple_requests creates one thread per engine, each thread runs the search_one_request function
* search_one_request calls the request function, make the HTTP request, calls the response function, extends the result_container
* search_multiple_requests waits for the the thread to finish (or timeout)
2016-11-05 13:45:20 +01:00
Adam Tauber
86daef2063 [fix] do not allow underscore in engine names - closes #708 2016-09-28 22:30:05 +02:00
Adam Tauber
7d9c898170 Merge pull request #634 from kvch/advanced-search
support time range search
2016-07-26 00:06:16 +02:00
Adam Tauber
54d987636e [fix] do not load engines which cannot be initialized - closes #585 2016-07-25 23:36:52 +02:00
Noemi Vanyi
93c0c49e9a add time range search with yahoo 2016-07-25 23:19:46 +02:00
Adam Tauber
257e52954a [enh][fix] update to latest dependencies ++ fix tests & travis test runner
WARNING: dependency changes
2016-07-04 22:46:43 +02:00
Adam Tauber
10947536aa [enh] suspend engines after error
The duration is based on the number of continuous errors, but maximized in one minute
2016-02-20 00:21:56 +01:00
Adam Tauber
17b0c9f74a [mod] engine load refactor 2016-02-19 15:13:01 +01:00
Adam Tauber
1fcf066a81 [mod] change settings file structure according to #314 2015-08-02 20:32:22 +02:00
Alexandre Flament
6765823c56 [fix] set engine.safesearch to False if not defined 2015-05-30 12:37:18 +02:00
Alexandre Flament
4689fe341c update versions.cfg to use the current up-to-date packages 2015-05-02 15:45:17 +02:00
Adam Tauber
b19e681cce [enh] default disabled engines - closes #109 2015-01-31 23:11:45 +01:00
Adam Tauber
299a80a1eb [enh] using the logger 2015-01-09 04:13:05 +01:00
Cqoicebordel
5d977056f7 Flake8 and Twitter corrections
Lots of Flake8 corrections
Maybe we should change the rule to allow lines of 120 chars. It seems more usable.

Big twitter correction : now it outputs the words in right order...
2014-12-29 21:31:04 +01:00
Adam Tauber
2e41bfcbdb [enh] engine shortcut validation 2014-12-20 12:17:03 +01:00
Adam Tauber
2cfa760b57 [mod] engine load refactor 2014-12-13 19:26:40 +01:00
Adam Tauber
5740cfbf1c [fix] pep8 part II. 2014-10-19 12:41:04 +02:00
Thomas Pointhuber
fdad5f7cad fix float division by zero bug in score calculation 2014-10-01 19:16:34 +02:00
Adam Tauber
b0ba367a1a [enh][mod] search refactor 2014-07-07 13:59:27 +02:00
Adam Tauber
a07b2b514c [fix] url path unquoted check to avoid duplications 2014-07-05 17:33:19 +02:00
Adam Tauber
b226e6462b [fix] www. domain duplications 2014-05-20 01:16:49 +02:00
Adam Tauber
2be94c2078 [enh] engine default category init 2014-03-08 13:59:50 +01:00
asciimoo
5b2680be4b [enh] new engine parameter: timeout 2014-02-13 17:08:22 +01:00
asciimoo
c1d7d30b8e [mod] len() removed from conditions 2014-02-11 13:13:51 +01:00
asciimoo
9eb31c0186 [fix] unicode and pep8 fixes 2014-02-07 02:45:12 +01:00
Gabor Nagy
22fd0746d9 Improves PEP8 compatibility. 2014-02-05 20:24:31 +01:00
asciimoo
88425f05d6 [enh] shortcut support added to engines 2014-01-31 15:45:18 +01:00
asciimoo
2a788c8f29 [enh] search language support init 2014-01-31 04:35:23 +01:00
asciimoo
8bb94e3dc4 [enh] paging support 2014-01-29 20:52:04 +01:00
asciimoo
2b1d2dbc84 [enh] i18n support 2014-01-22 00:17:49 +01:00
asciimoo
b2492c94f4 [fix] pep/flake8 compatibility 2014-01-20 02:31:20 +01:00