mirror of
https://github.com/searxng/searxng.git
synced 2026-05-26 21:00:13 +02:00
dd27fce3b7
In the result-list, the ``number_of_results`` indicate the number of hits in the Index, they do not indicate how many results are in the answer. In the past, search engines such as google or ddg had an indication on the first page of a search term of how many hits there were for this term in total in their index. This info was added up in SearXNG and delivered under ``number_of_results``. Nowadays the search engines no longer indicate how many hits there are in the index and so this field in SearXNG is also superfluous. - https://github.com/searxng/searxng/issues/2457#issuecomment-2566181574 - https://github.com/searxng/searxng/issues/2987 - https://github.com/searxng/searxng/issues/5034 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
58 lines
1.3 KiB
Python
58 lines
1.3 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
"""
|
|
Searx (all)
|
|
"""
|
|
|
|
from json import loads
|
|
from searx.engines import categories as searx_categories
|
|
|
|
# about
|
|
about = {
|
|
"website": 'https://github.com/searxng/searxng',
|
|
"wikidata_id": 'Q17639196',
|
|
"official_api_documentation": 'https://docs.searxng.org/dev/search_api.html',
|
|
"use_official_api": True,
|
|
"require_api_key": False,
|
|
"results": 'JSON',
|
|
}
|
|
|
|
categories = searx_categories.keys()
|
|
|
|
# search-url
|
|
instance_urls = []
|
|
instance_index = 0
|
|
|
|
|
|
# do search-request
|
|
def request(query, params):
|
|
global instance_index # pylint: disable=global-statement
|
|
params['url'] = instance_urls[instance_index % len(instance_urls)]
|
|
params['method'] = 'POST'
|
|
|
|
instance_index += 1
|
|
|
|
params['data'] = {
|
|
'q': query,
|
|
'pageno': params['pageno'],
|
|
'language': params['language'],
|
|
'time_range': params['time_range'],
|
|
'category': params['category'],
|
|
'format': 'json',
|
|
}
|
|
|
|
return params
|
|
|
|
|
|
# get response from search-request
|
|
def response(resp):
|
|
|
|
response_json = loads(resp.text)
|
|
results = response_json['results']
|
|
|
|
for i in ('answers', 'infoboxes'):
|
|
results.extend(response_json[i])
|
|
|
|
results.extend({'suggestion': s} for s in response_json['suggestions'])
|
|
|
|
return results
|