diff options
author | Adam Tauber <asciimoo@gmail.com> | 2021-03-02 14:24:55 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2021-03-06 12:12:35 +0100 |
commit | 44f4a9d49a0d78668b37fca8558ae63c5fdef271 (patch) | |
tree | 5eb04f4a6efc0537fc21d019990428b4a9b5c4b6 /searx/results.py | |
parent | 87f4cc4a9e51f1215f1450ea056ac40e7a961978 (diff) | |
download | searxng-44f4a9d49a0d78668b37fca8558ae63c5fdef271.tar.gz searxng-44f4a9d49a0d78668b37fca8558ae63c5fdef271.zip |
[enh] add ability to send engine data to subsequent requests
Diffstat (limited to 'searx/results.py')
-rw-r--r-- | searx/results.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/searx/results.py b/searx/results.py index fb7e816eb..b3b874118 100644 --- a/searx/results.py +++ b/searx/results.py @@ -1,4 +1,5 @@ import re +from collections import defaultdict from operator import itemgetter from threading import RLock from urllib.parse import urlparse, unquote @@ -144,7 +145,7 @@ class ResultContainer: """docstring for ResultContainer""" __slots__ = '_merged_results', 'infoboxes', 'suggestions', 'answers', 'corrections', '_number_of_results',\ - '_ordered', 'paging', 'unresponsive_engines', 'timings', 'redirect_url' + '_ordered', 'paging', 'unresponsive_engines', 'timings', 'redirect_url', 'engine_data' def __init__(self): super().__init__() @@ -154,6 +155,7 @@ class ResultContainer: self.answers = {} self.corrections = set() self._number_of_results = [] + self.engine_data = defaultdict(dict) self._ordered = False self.paging = False self.unresponsive_engines = set() @@ -175,6 +177,8 @@ class ResultContainer: self._merge_infobox(result) elif 'number_of_results' in result: self._number_of_results.append(result['number_of_results']) + elif 'engine_data' in result: + self.engine_data[engine_name][result['key']] = result['engine_data'] else: # standard result (url, title, content) if 'url' in result and not isinstance(result['url'], str): |