.oO SearXNG Developer Documentation Oo.
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Variables
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Files
File List
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1
# SPDX-License-Identifier: AGPL-3.0-or-later
2
"""Typification of the result items generated by the *engines*, *answerers* and
3
*plugins*.
4
5
.. note::
6
7
We are at the beginning of typing the results. Further typing will follow,
8
but this is a very large task that we will only be able to implement
9
gradually. For more, please read :ref:`result types`.
10
11
"""
12
# pylint: disable=too-few-public-methods
13
14
from
__future__
import
annotations
15
16
__all__ = [
"Result"
,
"MainResult"
,
"KeyValue"
,
"EngineResults"
,
"AnswerSet"
,
"Answer"
,
"Translations"
]
17
18
import
abc
19
20
from
searx
import
enginelib
21
22
from
._base
import
Result, MainResult, LegacyResult
23
from
.answer
import
AnswerSet, Answer, Translations
24
from
.keyvalue
import
KeyValue
25
26
27
class
ResultList
(list, abc.ABC):
28
"""Base class of all result lists (abstract)."""
29
30
class
types
:
# pylint: disable=invalid-name
31
"""The collection of result types (which have already been implemented)."""
32
33
Answer = Answer
34
KeyValue = KeyValue
35
MainResult = MainResult
36
Result = Result
37
Translations = Translations
38
39
# for backward compatibility
40
LegacyResult = LegacyResult
41
30
class
types
:
# pylint: disable=invalid-name
…
42
def
__init__
(self):
43
# pylint: disable=useless-parent-delegation
44
super().
__init__
()
45
42
def
__init__
(self):
…
46
def
add
(self, result: Result | LegacyResult):
47
"""Add a :py:`Result` item to the result list."""
48
self.append(result)
49
50
46
def
add
(self, result: Result | LegacyResult):
…
27
class
ResultList
(list, abc.ABC):
…
51
class
EngineResults
(
ResultList
):
52
"""Result list that should be used by engine developers. For convenience,
53
engine developers don't need to import types / see :py:obj:`ResultList.types`.
54
55
.. code:: python
56
57
from searx.result_types import EngineResults
58
...
59
def response(resp) -> EngineResults:
60
res = EngineResults()
61
...
62
res.add( res.types.Answer(answer="lorem ipsum ..", url="https://example.org") )
63
...
64
return res
65
"""
51
class
EngineResults
(
ResultList
):
…
searx.result_types.EngineResults
Definition
__init__.py:51
searx.result_types.ResultList.types
Definition
__init__.py:30
searx.result_types.ResultList
Definition
__init__.py:27
searx.result_types.ResultList.__init__
__init__(self)
Definition
__init__.py:42
searx.result_types.ResultList.add
add(self, Result|LegacyResult result)
Definition
__init__.py:46
searxng
searx
result_types
__init__.py
Generated on Sat Apr 5 2025 21:19:37 for .oO SearXNG Developer Documentation Oo. by
1.13.2