diff --git a/searx/engines/wikidata.py b/searx/engines/wikidata.py index 44c5b124e..7abd0dee3 100644 --- a/searx/engines/wikidata.py +++ b/searx/engines/wikidata.py @@ -31,7 +31,7 @@ if TYPE_CHECKING: traits: EngineTraits -display_type = "list" +display_type = ["infobox"] # about about = { @@ -270,7 +270,7 @@ def get_results(attribute_result, attributes, language): for url in value.split(', '): infobox_urls.append({'title': attribute.get_label(language), 'url': url, **attribute.kwargs}) # "normal" results (not infobox) include official website and Wikipedia links. - if display_type == "list" and (attribute.kwargs.get('official') or attribute_type == WDArticle): + if "infobox" in display_type and (attribute.kwargs.get('official') or attribute_type == WDArticle): results.append({'title': infobox_title, 'url': url, "content": infobox_content}) # update the infobox_id with the wikipedia URL # first the local wikipedia URL, and as fallback the english wikipedia URL @@ -309,7 +309,7 @@ def get_results(attribute_result, attributes, language): if img_src is None and len(infobox_attributes) == 0 and len(infobox_urls) == 1 and len(infobox_content) == 0: results.append({'url': infobox_urls[0]['url'], 'title': infobox_title, 'content': infobox_content}) - elif display_type == "infobox": + elif "infobox" in display_type: results.append( { 'infobox': infobox_title, diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py index 9a6ccd30e..51d566eac 100644 --- a/searx/engines/wikipedia.py +++ b/searx/engines/wikipedia.py @@ -67,7 +67,7 @@ from searx.enginelib.traits import EngineTraits traits: EngineTraits -display_type = "list" +display_type = ["infobox"] # about about = { @@ -188,10 +188,10 @@ def response(resp): title = utils.html_to_text(api_result.get('titles', {}).get('display') or api_result.get('title')) wikipedia_link = api_result['content_urls']['desktop']['page'] - if display_type == "list": + if "list" in display_type: results.append({'url': wikipedia_link, 'title': title, 'content': api_result.get('description', '')}) - if display_type == "infobox": + if "infobox" in display_type: if api_result.get('type') == 'standard': results.append( { diff --git a/searx/settings.yml b/searx/settings.yml index 0e787a8dd..1de6bd7f1 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -369,15 +369,8 @@ engines: - name: wikipedia engine: wikipedia shortcut: wp - display_type: "list" - base_url: 'https://{language}.wikipedia.org/' - categories: [general] - disabled: true - - - name: wikipedia.infobox - engine: wikipedia - shortcut: wpi - display_type: "infobox" + # add "list" to the array to get results in the results list + display_type: ["infobox"] base_url: 'https://{language}.wikipedia.org/' categories: [general] @@ -592,17 +585,9 @@ engines: shortcut: wd timeout: 3.0 weight: 2 - display_type: "list" + # add "list" to the array to get results in the results list + display_type: ["infobox"] tests: *tests_infobox - disabled: true - categories: [general] - - - name: wikidata.infobox - engine: wikidata - timeout: 3.0 - shortcut: wdi - weight: 2 - display_type: "infobox" categories: [general] - name: duckduckgo