|
.oO SearXNG Developer Documentation Oo.
|
Functions | |
| None | request (str query, "OnlineParams" params) |
| EngineResults | response ("SXNG_Response" resp) |
| str | _stringify_pages (dict[str, t.Any] biblio) |
| datetime|None | _parse_date (str|None value) |
| str | _doi_to_plain (str|None doi_value) |
| str|None | _reconstruct_abstract (dict[str, list[int]]|None abstract_inverted_index) |
| tuple[str, str, str] | _extract_links (dict[str, t.Any] item) |
| list[str] | _extract_authors (dict[str, t.Any] item) |
| list[str] | _extract_tags (dict[str, t.Any] item) |
| tuple[str, str, str, str, str, datetime|None] | _extract_biblio (dict[str, t.Any] item) |
| str | _extract_comments (dict[str, t.Any] item) |
Variables | |
| dict | about |
| list | categories = ["science", "scientific publications"] |
| bool | paging = True |
| str | search_url = "https://api.openalex.org/works" |
| str | mailto = "" |
The OpenAlex engine integrates the `OpenAlex`_ Works API to return scientific
paper results using the :ref:`result_types.paper` class. It is an "online" JSON
engine that uses the official public API and does not require an API key.
.. _OpenAlex: https://openalex.org
.. _OpenAlex API overview: https://docs.openalex.org/how-to-use-the-api/api-overview
Key features
------------
- Uses the official Works endpoint (JSON)
- Paging support via ``page`` and ``per-page``
- Relevance sorting (``sort=relevance_score:desc``)
- Language filter support (maps SearXNG language to ``filter=language:<iso2>``)
- Maps fields commonly used in scholarly results: title, authors, abstract
(reconstructed from inverted index), journal/venue, publisher, DOI, tags
(concepts), PDF/HTML links, pages, volume, issue, published date, and a short
citations comment
- Supports OpenAlex "polite pool" by adding a ``mailto`` parameter
Configuration
=============
Minimal example for :origin:`settings.yml <searx/settings.yml>`:
.. code:: yaml
- name: openalex
engine: openalex
shortcut: oa
categories: science, scientific publications
timeout: 5.0
# Recommended by OpenAlex: join the polite pool with an email address
mailto: "[email protected]"
Notes
-----
- The ``mailto`` key is optional but recommended by OpenAlex for better service.
- Language is inherited from the user's UI language; when it is not ``all``, the
engine adds ``filter=language:<iso2>`` (e.g. ``language:fr``). If OpenAlex has
few results for that language, you may see fewer items.
- Results typically include a main link. When the primary landing page from
OpenAlex is a DOI resolver, the engine will use that stable link. When an open
access link is available, it is exposed via the ``PDF`` and/or ``HTML`` links
in the result footer.
What is returned
================
Each result uses the :ref:`result_types.paper` class and may include:
- ``title`` and ``content`` (abstract; reconstructed from the inverted index)
- ``authors`` (display names)
- ``journal`` (host venue display name) and ``publisher``
- ``doi`` (normalized to the plain DOI, without the ``https://doi.org/`` prefix)
- ``tags`` (OpenAlex concepts display names)
- ``pdf_url`` (Open access PDF if available) and ``html_url`` (landing page)
- ``publishedDate`` (parsed from ``publication_date``)
- ``pages``, ``volume``, ``number`` (issue)
- ``type`` and a brief ``comments`` string with citation count
Rate limits & polite pool
=========================
OpenAlex offers a free public API with generous daily limits. For extra courtesy
and improved service quality, include a contact email in each request via
``mailto``. You can set it directly in the engine configuration as shown above.
See: `OpenAlex API overview`_.
Troubleshooting
===============
- Few or no results in a non-English UI language:
Ensure the selected language has sufficient coverage at OpenAlex, or set the
UI language to English and retry.
- Preference changes fail while testing locally:
Make sure your ``server.secret_key`` and ``server.base_url`` are set in your
instance settings so signed cookies work; see :ref:`settings server`.
Implementation
===============
|
protected |
Definition at line 214 of file openalex.py.
Referenced by response().
|
protected |
Definition at line 256 of file openalex.py.
Referenced by response().
|
protected |
Definition at line 277 of file openalex.py.
References _parse_date(), and _stringify_pages().
Referenced by response().
|
protected |
Definition at line 292 of file openalex.py.
Referenced by response().
|
protected |
Definition at line 242 of file openalex.py.
Referenced by response().
|
protected |
Definition at line 268 of file openalex.py.
Referenced by response().
|
protected |
Definition at line 202 of file openalex.py.
Referenced by _extract_biblio().
|
protected |
Definition at line 221 of file openalex.py.
Referenced by response().
|
protected |
Definition at line 190 of file openalex.py.
Referenced by _extract_biblio().
| None searx.engines.openalex.request | ( | str | query, |
| "OnlineParams" | params ) |
Definition at line 123 of file openalex.py.
| EngineResults searx.engines.openalex.response | ( | "SXNG_Response" | resp | ) |
Definition at line 152 of file openalex.py.
References _doi_to_plain(), _extract_authors(), _extract_biblio(), _extract_comments(), _extract_links(), _extract_tags(), and _reconstruct_abstract().
| dict searx.engines.openalex.about |
Definition at line 103 of file openalex.py.
| list searx.engines.openalex.categories = ["science", "scientific publications"] |
Definition at line 114 of file openalex.py.
| str searx.engines.openalex.mailto = "" |
Definition at line 120 of file openalex.py.
| bool searx.engines.openalex.paging = True |
Definition at line 115 of file openalex.py.
| str searx.engines.openalex.search_url = "https://api.openalex.org/works" |
Definition at line 116 of file openalex.py.