Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

[enh] engines: add about variable #2460

Merged
merged 1 commit into from Jan 16, 2021
Merged

[enh] engines: add about variable #2460

merged 1 commit into from Jan 16, 2021

Conversation

dalf
Copy link
Contributor

@dalf dalf commented Jan 13, 2021

What does this PR do?

move meta information from comment to the about variable
so the preferences, the documentation can show these information

the different URL have been checked and updated (especially API documentation URL).

Also:

Why is this change important?

See #2442

Currently the engine list in /prefereneces or in the documentation show a list of name without a description or a link.

This PR adds the required information to implement this feature, but I suggest to implement the UI in another PR.

Without this PR, the top head comment in an engine provides some information:

  • @website : the user URL, exactly what would be nice to display to the user.
  • @provide-api : does the actual engine provide an official API ? usually the source code include an URL.
  • @using-api: does searx use this API ?
  • @results: what kind of data searx deal with ? HTML, JSON, XML
  • @stable: is the searx engine stable ?
  • @parse: what kind of data the searx engine return ?

IMO:

  • @stable without update will be wrong:
    • an official API can change.
    • the HTML layout of an engine can remain stable over time.
    • I suggest to remove this attribute : @results = HTML is enough to understand that searx engine is "unstable".
  • @parse: is it useful ? I suggest to remove this attribute

In this PR, these attributes are replaced by a variable:

about = {
    "website": 'https://arxiv.org',   # official user URL
    "wikidata_id": 'Q118398',   # wikidata identifier : see https://www.wikidata.org/wiki/Q28134166
    "official_api_documentation": 'https://arxiv.org/help/api',  # API documentation URL 
    "use_official_api": True,  # does the engine use the official API ?
    "require_api_key": False,  # does the engine requires a key ?
    "results": 'XML-RSS',  # same as before : what kind of data the searx engine deal with ?
}

The wikidata_id is interesting for different purposes:

How to test this PR locally?

  • For now, the about is not used, there is nothing to test.

Author's checklist

Related issues

WIP

  • settings.yml : add about section for engines using the json or xpath engines.
  • check the about validity in searx.engines.__init__

@dalf dalf force-pushed the engine-about branch 12 times, most recently from c58e803 to 4a22b1f Compare January 14, 2021 14:56
@dalf dalf force-pushed the engine-about branch 2 times, most recently from 2a0e79c to 89aa585 Compare January 14, 2021 19:47
@dalf dalf marked this pull request as ready for review January 14, 2021 19:48
@dalf dalf requested review from unixfox and kvch and removed request for unixfox January 14, 2021 19:48
move meta information from comment to the about variable
so the preferences, the documentation can show these information
Copy link
Member

@unixfox unixfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and great changes!

@dalf dalf merged commit 1d13ad8 into searx:master Jan 16, 2021
@dalf dalf deleted the engine-about branch January 16, 2021 18:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants