summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzutto <zutto@localhost>2023-08-02 10:35:08 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2023-08-03 19:58:51 +0200
commitca518c68035ffa60825eedd3ef4cfb404605c78c (patch)
treea3c98f9319ad2de288f538ecf7acc1cf6c0e88ac
parent203f1f0928c5d08410d552afabc3e3eb7e861747 (diff)
downloadsearxng-ca518c68035ffa60825eedd3ef4cfb404605c78c.tar.gz
searxng-ca518c68035ffa60825eedd3ef4cfb404605c78c.zip
add option to change yacy search mode
-rw-r--r--searx/engines/yacy.py10
-rw-r--r--searx/settings.yml4
2 files changed, 11 insertions, 3 deletions
diff --git a/searx/engines/yacy.py b/searx/engines/yacy.py
index 12e7305db..7283b7554 100644
--- a/searx/engines/yacy.py
+++ b/searx/engines/yacy.py
@@ -27,6 +27,7 @@ paging = True
number_of_results = 5
http_digest_auth_user = ""
http_digest_auth_pass = ""
+search_mode = 'global' # 'global', 'local'. By default, in yacy this is 'global'.
# search-url
base_url = 'http://localhost:8090'
@@ -35,7 +36,7 @@ search_url = (
'&startRecord={offset}'
'&maximumRecords={limit}'
'&contentdom={search_type}'
- '&resource=global'
+ '&resource={resource}'
)
# yacy specific type-definitions
@@ -48,7 +49,11 @@ def request(query, params):
search_type = search_types.get(params.get('category'), '0')
params['url'] = base_url + search_url.format(
- query=urlencode({'query': query}), offset=offset, limit=number_of_results, search_type=search_type
+ query=urlencode({'query': query}),
+ offset=offset,
+ limit=number_of_results,
+ search_type=search_type,
+ resource=search_mode,
)
if http_digest_auth_user and http_digest_auth_pass:
@@ -79,7 +84,6 @@ def response(resp):
for result in search_results[0].get('items', []):
# parse image results
if resp.search_params.get('category') == 'images':
-
result_url = ''
if 'url' in result:
result_url = result['url']
diff --git a/searx/settings.yml b/searx/settings.yml
index 0c6898d0f..589a3e75e 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -1760,6 +1760,10 @@ engines:
# enable_http: true
# number_of_results: 5
# timeout: 3.0
+ # Yacy search mode. 'global' or 'local'. by default, Yacy operates in 'global' mode.
+ # 'global' = Peer-to-Peer search
+ # 'local' = Privacy or Stealth mode, restricts the search to local yacy instance.
+ # search_mode: 'global'
- name: rumble
engine: rumble