Browse Source

oa_doi_rewrite: add the doi to the result when it is found.

Currentty, when oa_doi_rewrite find a DOI in the result URL, it replace the URL.
In this commit, the plugin adds the key "doi" to the result,
so the paper.html can show it.
Alexandre FLAMENT 2 years ago
parent
commit
593026ad9c
1 changed files with 2 additions and 0 deletions
  1. 2 0
      searx/plugins/oa_doi_rewrite.py

+ 2 - 0
searx/plugins/oa_doi_rewrite.py

@@ -42,4 +42,6 @@ def on_result(request, search, result):
                 doi = doi[: -len(suffix)]
                 doi = doi[: -len(suffix)]
         result['url'] = get_doi_resolver(request.preferences) + doi
         result['url'] = get_doi_resolver(request.preferences) + doi
         result['parsed_url'] = urlparse(result['url'])
         result['parsed_url'] = urlparse(result['url'])
+        if 'doi' not in result:
+            result['doi'] = doi
     return True
     return True