.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.mrs Namespace Reference

Functions

 init (engine_settings)
 
 request (query, params)
 
 response (resp)
 

Variables

dict about
 
bool paging = True
 
list categories = ['social media']
 
str base_url = ""
 
str matrix_url = "https://matrix.to"
 
int page_size = 20
 

Detailed Description

Matrix Rooms Search - a fully-featured, standalone, matrix rooms search service.

Configuration
=============

The engine has the following mandatory settings:

- :py:obj:`base_url`

.. code:: yaml

  - name: MRS
    engine: mrs
    base_url: https://mrs-host
    ...

Implementation
==============

Function Documentation

◆ init()

searx.engines.mrs.init ( engine_settings)
The ``base_url`` must be set in the configuration, if ``base_url`` is not
set, a :py:obj:`ValueError` is raised during initialization.

Definition at line 40 of file mrs.py.

40def init(engine_settings): # pylint: disable=unused-argument
41 """The ``base_url`` must be set in the configuration, if ``base_url`` is not
42 set, a :py:obj:`ValueError` is raised during initialization.
43
44 """
45 if not base_url:
46 raise ValueError('engine MRS, base_url is unset')
47
48

◆ request()

searx.engines.mrs.request ( query,
params )

Definition at line 49 of file mrs.py.

49def request(query, params):
50 params['url'] = f"{base_url}/search/{quote_plus(query)}/{page_size}/{(params['pageno']-1)*page_size}"
51 return params
52
53

◆ response()

searx.engines.mrs.response ( resp)

Definition at line 54 of file mrs.py.

54def response(resp):
55 results = []
56
57 for result in resp.json():
58 results.append(
59 {
60 'url': matrix_url + '/#/' + result['alias'],
61 'title': result['name'],
62 'content': result['topic']
63 + f" // {result['members']} members"
64 + f" // {result['alias']}"
65 + f" // {result['server']}",
66 'thumbnail': result['avatar_url'],
67 }
68 )
69
70 return results

Variable Documentation

◆ about

dict searx.engines.mrs.about
Initial value:
1= {
2 "website": 'https://matrixrooms.info',
3 "wikidata_id": None,
4 "official_api_documentation": 'https://gitlab.com/etke.cc/mrs/api/-/blob/main/openapi.yml?ref_type=heads',
5 "use_official_api": True,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 24 of file mrs.py.

◆ base_url

str searx.engines.mrs.base_url = ""

Definition at line 35 of file mrs.py.

◆ categories

list searx.engines.mrs.categories = ['social media']

Definition at line 33 of file mrs.py.

◆ matrix_url

str searx.engines.mrs.matrix_url = "https://matrix.to"

Definition at line 36 of file mrs.py.

◆ page_size

int searx.engines.mrs.page_size = 20

Definition at line 37 of file mrs.py.

◆ paging

bool searx.engines.mrs.paging = True

Definition at line 32 of file mrs.py.