diff options
Diffstat (limited to 'docs/dev/engines')
| -rw-r--r-- | docs/dev/engines/engine_overview.rst | 335 |
1 files changed, 9 insertions, 326 deletions
diff --git a/docs/dev/engines/engine_overview.rst b/docs/dev/engines/engine_overview.rst index 1a6270a3b..4aeb5b624 100644 --- a/docs/dev/engines/engine_overview.rst +++ b/docs/dev/engines/engine_overview.rst @@ -237,335 +237,18 @@ following parameters can be used to specify a search request: =================== =========== ========================================================================== -.. _engine results: -.. _engine media types: +Making a Response +================= -Result Types (``template``) -=========================== +In the ``response`` function of the engine, the HTTP response (``resp``) is +parsed and a list of results is returned. -Each result item of an engine can be of different media-types. Currently the -following media-types are supported. To set another media-type as -:ref:`template default`, the parameter ``template`` must be set to the desired -type. +A engine can append result-items of different media-types and different +result-types to the result list. The list of the result items is render to HTML +by templates. For more details read section: -.. _template default: +- :ref:`simple theme templates` +- :ref:`result types` -``default`` ------------ - -.. table:: Parameter of the **default** media type: - :width: 100% - - ========================= ===================================================== - result-parameter information - ========================= ===================================================== - url string, url of the result - title string, title of the result - content string, general result-text - publishedDate :py:class:`datetime.datetime`, time of publish - ========================= ===================================================== - - -.. _template images: - -``images`` ----------- - -.. list-table:: Parameter of the **images** media type - :header-rows: 2 - :width: 100% - - * - result-parameter - - Python type - - information - - * - template - - :py:class:`str` - - is set to ``images.html`` - - * - url - - :py:class:`str` - - url to the result site - - * - title - - :py:class:`str` - - title of the result - - * - content - - :py:class:`str` - - description of the image - - * - publishedDate - - :py:class:`datetime <datetime.datetime>` - - time of publish - - * - img_src - - :py:class:`str` - - url to the result image - - * - thumbnail_src - - :py:class:`str` - - url to a small-preview image - - * - resolution - - :py:class:`str` - - the resolution of the image (e.g. ``1920 x 1080`` pixel) - - * - img_format - - :py:class:`str` - - the format of the image (e.g. ``png``) - - * - filesize - - :py:class:`str` - - size of bytes in :py:obj:`human readable <searx.humanize_bytes>` notation - (e.g. ``MB`` for 1024 \* 1024 Bytes filesize). - - -.. _template videos: - -``videos`` ----------- - -.. table:: Parameter of the **videos** media type: - :width: 100% - - ========================= ===================================================== - result-parameter information - ------------------------- ----------------------------------------------------- - template is set to ``videos.html`` - ========================= ===================================================== - url string, url of the result - title string, title of the result - content *(not implemented yet)* - publishedDate :py:class:`datetime.datetime`, time of publish - thumbnail string, url to a small-preview image - length :py:class:`datetime.timedelta`, duration of result - views string, view count in humanized number format - ========================= ===================================================== - - -.. _template torrent: - -``torrent`` ------------ - -.. _magnetlink: https://en.wikipedia.org/wiki/Magnet_URI_scheme - -.. table:: Parameter of the **torrent** media type: - :width: 100% - - ========================= ===================================================== - result-parameter information - ------------------------- ----------------------------------------------------- - template is set to ``torrent.html`` - ========================= ===================================================== - url string, url of the result - title string, title of the result - content string, general result-text - publishedDate :py:class:`datetime.datetime`, - time of publish *(not implemented yet)* - seed int, number of seeder - leech int, number of leecher - filesize int, size of file in bytes - files int, number of files - magnetlink string, magnetlink_ of the result - torrentfile string, torrentfile of the result - ========================= ===================================================== - - -.. _template map: - -``map`` -------- - -.. table:: Parameter of the **map** media type: - :width: 100% - - ========================= ===================================================== - result-parameter information - ------------------------- ----------------------------------------------------- - template is set to ``map.html`` - ========================= ===================================================== - url string, url of the result - title string, title of the result - content string, general result-text - publishedDate :py:class:`datetime.datetime`, time of publish - latitude latitude of result (in decimal format) - longitude longitude of result (in decimal format) - boundingbox boundingbox of result (array of 4. values - ``[lat-min, lat-max, lon-min, lon-max]``) - geojson geojson of result (https://geojson.org/) - osm.type type of osm-object (if OSM-Result) - osm.id id of osm-object (if OSM-Result) - address.name name of object - address.road street name of object - address.house_number house number of object - address.locality city, place of object - address.postcode postcode of object - address.country country of object - ========================= ===================================================== - - -.. _template paper: - -``paper`` ---------- - -.. _BibTeX format: https://www.bibtex.com/g/bibtex-format/ -.. _BibTeX field types: https://en.wikipedia.org/wiki/BibTeX#Field_types - -.. list-table:: Parameter of the **paper** media type / - see `BibTeX field types`_ and `BibTeX format`_ - :header-rows: 2 - :width: 100% - - * - result-parameter - - Python type - - information - - * - template - - :py:class:`str` - - is set to ``paper.html`` - - * - title - - :py:class:`str` - - title of the result - - * - content - - :py:class:`str` - - abstract - - * - comments - - :py:class:`str` - - free text display in italic below the content - - * - tags - - :py:class:`List <list>`\ [\ :py:class:`str`\ ] - - free tag list - - * - publishedDate - - :py:class:`datetime <datetime.datetime>` - - last publication date - - * - type - - :py:class:`str` - - short description of medium type, e.g. *book*, *pdf* or *html* ... - - * - authors - - :py:class:`List <list>`\ [\ :py:class:`str`\ ] - - list of authors of the work (authors with a "s") - - * - editor - - :py:class:`str` - - list of editors of a book - - * - publisher - - :py:class:`str` - - name of the publisher - - * - journal - - :py:class:`str` - - name of the journal or magazine the article was - published in - - * - volume - - :py:class:`str` - - volume number - - * - pages - - :py:class:`str` - - page range where the article is - - * - number - - :py:class:`str` - - number of the report or the issue number for a journal article - - * - doi - - :py:class:`str` - - DOI number (like ``10.1038/d41586-018-07848-2``) - - * - issn - - :py:class:`List <list>`\ [\ :py:class:`str`\ ] - - ISSN number like ``1476-4687`` - - * - isbn - - :py:class:`List <list>`\ [\ :py:class:`str`\ ] - - ISBN number like ``9780201896831`` - - * - pdf_url - - :py:class:`str` - - URL to the full article, the PDF version - - * - html_url - - :py:class:`str` - - URL to full article, HTML version - - -.. _template packages: - -``packages`` ------------- - -.. list-table:: Parameter of the **packages** media type - :header-rows: 2 - :width: 100% - - * - result-parameter - - Python type - - information - - * - template - - :py:class:`str` - - is set to ``packages.html`` - - * - title - - :py:class:`str` - - title of the result - - * - content - - :py:class:`str` - - abstract - - * - package_name - - :py:class:`str` - - the name of the package - - * - version - - :py:class:`str` - - the current version of the package - - * - maintainer - - :py:class:`str` - - the maintainer or author of the project - - * - publishedDate - - :py:class:`datetime <datetime.datetime>` - - date of latest update or release - - * - tags - - :py:class:`List <list>`\ [\ :py:class:`str`\ ] - - free tag list - - * - popularity - - :py:class:`str` - - the popularity of the package, e.g. rating or download count - - * - license_name - - :py:class:`str` - - the name of the license - - * - license_url - - :py:class:`str` - - the web location of a license copy - - * - homepage - - :py:class:`str` - - the url of the project's homepage - * - source_code_url - - :py:class:`str` - - the location of the project's source code - * - links - - :py:class:`dict` - - additional links in the form of ``{'link_name': 'http://example.com'}`` |