summaryrefslogtreecommitdiff
path: root/searx/search
diff options
context:
space:
mode:
authorNoémi Ványi <kvch@users.noreply.github.com>2021-03-06 12:17:10 +0100
committerGitHub <noreply@github.com>2021-03-06 12:17:10 +0100
commit0d8b369b5b300e8a575d6715fc75067d09db63a5 (patch)
tree5eb04f4a6efc0537fc21d019990428b4a9b5c4b6 /searx/search
parent87f4cc4a9e51f1215f1450ea056ac40e7a961978 (diff)
parent44f4a9d49a0d78668b37fca8558ae63c5fdef271 (diff)
downloadsearxng-0d8b369b5b300e8a575d6715fc75067d09db63a5.tar.gz
searxng-0d8b369b5b300e8a575d6715fc75067d09db63a5.zip
Merge pull request #2615 from searx/engine-data
Add ability to send engine data to subsequent requests
Diffstat (limited to 'searx/search')
-rw-r--r--searx/search/__init__.py2
-rw-r--r--searx/search/models.py8
2 files changed, 8 insertions, 2 deletions
diff --git a/searx/search/__init__.py b/searx/search/__init__.py
index f777e8595..27c6c3a88 100644
--- a/searx/search/__init__.py
+++ b/searx/search/__init__.py
@@ -111,6 +111,8 @@ class Search:
if request_params is None:
continue
+ request_params['engine_data'] = self.search_query.engine_data.get(engineref.name, {})
+
with threading.RLock():
processor.engine.stats['sent_search_count'] += 1
diff --git a/searx/search/models.py b/searx/search/models.py
index 80ceaa223..21c0fe590 100644
--- a/searx/search/models.py
+++ b/searx/search/models.py
@@ -25,7 +25,7 @@ class SearchQuery:
"""container for all the search parameters (query, language, etc...)"""
__slots__ = 'query', 'engineref_list', 'lang', 'safesearch', 'pageno', 'time_range',\
- 'timeout_limit', 'external_bang'
+ 'timeout_limit', 'external_bang', 'engine_data'
def __init__(self,
query: str,
@@ -35,7 +35,8 @@ class SearchQuery:
pageno: int=1,
time_range: typing.Optional[str]=None,
timeout_limit: typing.Optional[float]=None,
- external_bang: typing.Optional[str]=None):
+ external_bang: typing.Optional[str]=None,
+ engine_data: typing.Optional[dict]=None):
self.query = query
self.engineref_list = engineref_list
self.lang = lang
@@ -44,6 +45,9 @@ class SearchQuery:
self.time_range = time_range
self.timeout_limit = timeout_limit
self.external_bang = external_bang
+ self.engine_data = engine_data
+ if engine_data is None:
+ self.engine_data = {}
@property
def categories(self):