Commit Graph

323 Commits

Author SHA1 Message Date
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
b9d4c0523e [fix] get doi_rewriters from settings - fixes #1245 2018-03-17 09:38:36 +01:00
Adam Tauber
b70ce84eb6 [enh] update translations - add taiwanese and filipino 2018-02-19 00:22:39 +01:00
Adam Tauber
49b845051f
Merge pull request #973 from MarcAbonce/languages
Remove 'all' option from search languages
2017-12-06 14:34:26 +01:00
marc
4d1770398a remove 'all' option from search languages 2017-12-06 01:20:15 -06:00
Adam Tauber
e060aedc16 [enh] make custom oscar option configurable from url 2017-12-05 22:30:20 +01:00
Adam Tauber
f65f90bf3c [fix] autocompleter py3 compatibility - fixes #1088 2017-11-23 17:42:52 +01:00
yujunqiang
ed1c78d923 fix bug: TypeError: set(['bing', 'google']) is not JSON serializable, when curl 'http://127.0.0.1:8888/?q=xxxxxxxx&categories=general&format=json' 2017-11-15 21:31:27 +08:00
Noémi Ványi
1b10abfc92 minor fixes of doi resolver
Closes #1047
2017-11-01 17:02:38 +01:00
jibe-b
575159b194 [enh] oa_doi_rewrite plugin broadens doai_rewrite 2017-11-01 14:22:26 +01:00
Adam Tauber
5f758b2d39 [mod] compress saved preferences in url 2017-10-26 00:06:03 +02:00
Noémi Ványi
e73cb14889 fix hmac python3 compatibility 2017-09-08 21:33:11 +02:00
misnyo
ae99f9070c [fix] static path fixed in templates and webapp, line endings fixed 2017-09-08 20:33:14 +02:00
Adam Tauber
f2b13a7de0 [enh] allow default empty values for normal and result proxies 2017-07-20 13:32:20 +02:00
Noémi Ványi
243d3e4298 show engine errors in infobox && add new error alert 2017-07-12 16:29:11 +02:00
Adam Tauber
38d6ba4066 [enh] generate search url of saved preferences 2017-07-10 12:50:13 +02:00
Adam Tauber
6d76d9b202 [fix] load engines if debug mode is enabled using uwsgi 2017-06-12 12:47:42 +02:00
Alexandre Flament
87f673336f [fix] rss feed : the jinja template was not found when the rss feed returns an valid feed including an error. 2017-05-22 22:20:35 +02:00
Alexandre Flament
9c91ab33f8 [mod] settings.yml can be /etc/searx/settings.yml
The exact order is
* first from SEARX_SETTINGS_PATH,
* if not found then from searx code base,
* if not found then from /etc/searx/settings.yml
* if not found an exception stops searx loading
2017-05-15 22:19:42 +02:00
Alexandre Flament
ee080feaed [mod] the static and templates directories can be defined in the settings.yml 2017-05-15 21:23:13 +02:00
Adam Tauber
52e615dede [enh] py3 compatibility 2017-05-15 12:02:30 +02:00
Alexandre Flament
181c12ae04 [mod] upgrade requirements.txt 2017-03-23 21:26:51 +01:00
Alexandre Flament
e67dfaaac7 Merge branch 'master' into flask_perimeter 2017-01-27 13:47:59 +00:00
Alexandre Flament
15eef0ebdb [enh] validate input and raise an exception inside search.py. The exception message is output in json and rss format. 2017-01-20 18:52:47 +01:00
Alexandre Flament
7fdfeca3a4 [mod] add a __common__ template that can't be selected but that provides a common place for shared templates.
What has been moved into this template :
* opensearch*.xml is always the same whatever the themes.
* the text inside */about.html
2017-01-20 15:40:38 +01:00
David A Roberts
1d30141c20 [enh] show spelling corrections 2017-01-16 13:31:16 +10:00
Alexandre Flament
7a16aca346 Merge branch 'master' into flask_perimeter 2017-01-15 22:18:20 +01:00
Dalf
06bea82935 [mod] /config API : add language_support, paging, safesearch, supported_languages, time_range_support, timeout fields. 2017-01-07 14:42:55 +01:00
Alexandre Flament
84a2c97a65 [mod] searx uses flask framework only in webapp.py. Make migration to another framework easier. 2017-01-02 12:06:04 +01:00
Adam Tauber
7388067f15 [fix] load engines with uwsgi too 2016-12-28 21:17:51 +01:00
Adam Tauber
8bff42f049 Merge branch 'master' into languages 2016-12-28 20:00:53 +01:00
Adam Tauber
68cbf0448f [fix] do not reload engines twice if started with debug mode 2016-12-27 17:31:14 +01:00
Adam Tauber
a605377c40 [enh] explicit engine init 2016-12-27 17:31:14 +01:00
Adam Tauber
14f58bdaec [fix] robot tests ++ set default value for server http protocol version 2016-12-25 23:31:51 +01:00
Adam Tauber
a98bbefbcf [enh] configurable listening http protocol version 2016-12-25 23:05:01 +01: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
Adam Tauber
a764ebb4b1 [enh] extend json response with suggestions, infoboxes and answers 2016-12-10 21:38:34 +01:00
Alexandre Flament
e48f07a367 Merge branch 'master' into searchpy2 2016-12-09 23:11:45 +01:00
Adam Tauber
d80fb2c8e8 [enh] central handling of empty result titles 2016-12-09 19:57:28 +01:00
Adam Tauber
ef2ef7974a [enh] central html escaping of results 2016-12-09 19:10:33 +01:00
Adam Tauber
971ed0abd1 [enh] add quick answer functionality with an example answerer 2016-11-19 20:53:51 +01:00
Adam Tauber
827f9e41ca [fix] gettext requires request.preferences 2016-11-15 09:56:18 +01:00
Adam Tauber
a757c2f005 [fix] remove unused imports 2016-11-14 22:15:03 +01:00
Adam Tauber
832cf37a97 [enh] display errors
also tried flask's flash feature but flask creates session cookies if it
isn't flushed. Avoiding session cookies to preserve privacy
2016-11-14 22:07:23 +01:00
Adam Tauber
94196c4b6c [enh] show traceback of search errors 2016-11-14 15:49:06 +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
Alexandre Flament
58a6c045c8 [mod] replace references request.request_data (GET or POST parameters) by request.form (based on merge of POST and GET parameters) 2016-11-02 14:52:22 +01:00
dalf
67e11c42b9 Clean up the architecture
Purposes :
- isolate the plugins calls
- distinction between parsing the web request and running the search (Search class). To be able to test code easily, to run searx code outside a web server, to filter the search query parameters with plugins more easily, etc...

Details :
- request.request_data contains request.form or request.args (initialize inside pre_request() function)
- Query class is renamed RawTextQuery
- SearchQuery class defines all search parameters
- get_search_query_from_webapp create a SearchQuery instance (basically the previous Search.__init__ code)
- Search class and SearchWithPlugins class takes a SearchQuery instance as class constructor parameter
- SearchWithPlugins class inherites from Search class, and run plugins
- A dedicated function search_with_plugins executes plugins to have a well define locals() (which is used by the plugins code).
- All plugins code is executed inside the try...except block (webapp.py, index function)
- advanced_search HTTP parameter value stays in webapp.py (it is only part of UI)
- multiple calls to result_container.get_ordered_results() doesn't compute the order multiple time (note : this method was call only once before)
- paging value is stored in the result_container class (compute in the extend method)
- test about engine.suspend_end_time is done during search method call (instead of __init__)
- check that the format parameter value is one of these : html, rss, json, rss (before the html value was assumed but some text formatting wasn't not done)
2016-11-02 14:22:16 +01:00
Adam Tauber
6243639f01 [mod] do not proxify images if image proxy is not set 2016-10-30 21:15:46 +01:00