.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.search.models.SearchQuery Class Reference

Public Member Functions

 __init__ (self, str query, typing.List[EngineRef] engineref_list, str lang='all', int safesearch=0, int pageno=1, typing.Optional[str] time_range=None, typing.Optional[float] timeout_limit=None, typing.Optional[str] external_bang=None, typing.Optional[typing.Dict[str, str]] engine_data=None, typing.Optional[bool] redirect_to_first_result=None)
 
 categories (self)
 
 __repr__ (self)
 
 __eq__ (self, other)
 
 __hash__ (self)
 
 __copy__ (self)
 

Public Attributes

 query = query
 
 engineref_list = engineref_list
 
 lang = lang
 
 safesearch = safesearch
 
 pageno = pageno
 
 time_range = time_range
 
 timeout_limit = timeout_limit
 
 external_bang = external_bang
 
 engine_data = engine_data or {}
 
 redirect_to_first_result = redirect_to_first_result
 
 locale = None
 

Static Private Attributes

tuple __slots__
 

Detailed Description

container for all the search parameters (query, language, etc...)

Definition at line 27 of file models.py.

Constructor & Destructor Documentation

◆ __init__()

searx.search.models.SearchQuery.__init__ ( self,
str query,
typing.List[EngineRef] engineref_list,
str lang = 'all',
int safesearch = 0,
int pageno = 1,
typing.Optional[str] time_range = None,
typing.Optional[float] timeout_limit = None,
typing.Optional[str] external_bang = None,
typing.Optional[typing.Dict[str, str]] engine_data = None,
typing.Optional[bool] redirect_to_first_result = None )

Definition at line 44 of file models.py.

56 ): # pylint:disable=too-many-arguments
57 self.query = query
58 self.engineref_list = engineref_list
59 self.lang = lang
60 self.safesearch = safesearch
61 self.pageno = pageno
62 self.time_range = time_range
63 self.timeout_limit = timeout_limit
64 self.external_bang = external_bang
65 self.engine_data = engine_data or {}
66 self.redirect_to_first_result = redirect_to_first_result
67
68 self.locale = None
69 if self.lang:
70 try:
71 self.locale = babel.Locale.parse(self.lang, sep='-')
72 except babel.core.UnknownLocaleError:
73 pass
74

Member Function Documentation

◆ __copy__()

searx.search.models.SearchQuery.__copy__ ( self)

Definition at line 120 of file models.py.

120 def __copy__(self):
121 return SearchQuery(
122 self.query,
123 self.engineref_list,
124 self.lang,
125 self.safesearch,
126 self.pageno,
127 self.time_range,
128 self.timeout_limit,
129 self.external_bang,
130 self.engine_data,
131 self.redirect_to_first_result,
132 )

References searx.results.ResultContainer.engine_data, searx.search.models.SearchQuery.engine_data, searx.search.checker.impl.Checker.engineref_list(), searx.search.models.SearchQuery.engineref_list, searx.query.RawTextQuery.external_bang, searx.search.models.SearchQuery.external_bang, searx.search.models.SearchQuery.lang, searx.search.models.SearchQuery.pageno, searx.query.RawTextQuery.query, searx.search.models.SearchQuery.query, searx.query.RawTextQuery.redirect_to_first_result, searx.search.models.SearchQuery.redirect_to_first_result, searx.search.models.SearchQuery.safesearch, searx.search.models.SearchQuery.time_range, searx.query.RawTextQuery.timeout_limit, and searx.search.models.SearchQuery.timeout_limit.

+ Here is the call graph for this function:

◆ __eq__()

searx.search.models.SearchQuery.__eq__ ( self,
other )

Definition at line 92 of file models.py.

92 def __eq__(self, other):
93 return (
94 self.query == other.query
95 and self.engineref_list == other.engineref_list
96 and self.lang == other.lang
97 and self.safesearch == other.safesearch
98 and self.pageno == other.pageno
99 and self.time_range == other.time_range
100 and self.timeout_limit == other.timeout_limit
101 and self.external_bang == other.external_bang
102 and self.redirect_to_first_result == other.redirect_to_first_result
103 )
104

References searx.search.checker.impl.Checker.engineref_list(), searx.search.models.SearchQuery.engineref_list, searx.query.RawTextQuery.external_bang, searx.search.models.SearchQuery.external_bang, searx.search.models.SearchQuery.lang, searx.search.models.SearchQuery.pageno, searx.query.RawTextQuery.query, searx.search.models.SearchQuery.query, searx.query.RawTextQuery.redirect_to_first_result, searx.search.models.SearchQuery.redirect_to_first_result, searx.search.models.SearchQuery.safesearch, searx.search.models.SearchQuery.time_range, searx.query.RawTextQuery.timeout_limit, and searx.search.models.SearchQuery.timeout_limit.

+ Here is the call graph for this function:

◆ __hash__()

searx.search.models.SearchQuery.__hash__ ( self)

Definition at line 105 of file models.py.

105 def __hash__(self):
106 return hash(
107 (
108 self.query,
109 tuple(self.engineref_list),
110 self.lang,
111 self.safesearch,
112 self.pageno,
113 self.time_range,
114 self.timeout_limit,
115 self.external_bang,
116 self.redirect_to_first_result,
117 )
118 )
119

References searx.search.checker.impl.Checker.engineref_list(), searx.search.models.SearchQuery.engineref_list, searx.query.RawTextQuery.external_bang, searx.search.models.SearchQuery.external_bang, searx.search.models.SearchQuery.lang, searx.search.models.SearchQuery.pageno, searx.query.RawTextQuery.query, searx.search.models.SearchQuery.query, searx.query.RawTextQuery.redirect_to_first_result, searx.search.models.SearchQuery.redirect_to_first_result, searx.search.models.SearchQuery.safesearch, searx.search.models.SearchQuery.time_range, searx.query.RawTextQuery.timeout_limit, and searx.search.models.SearchQuery.timeout_limit.

+ Here is the call graph for this function:

◆ __repr__()

searx.search.models.SearchQuery.__repr__ ( self)

Definition at line 79 of file models.py.

79 def __repr__(self):
80 return "SearchQuery({!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r})".format(
81 self.query,
82 self.engineref_list,
83 self.lang,
84 self.safesearch,
85 self.pageno,
86 self.time_range,
87 self.timeout_limit,
88 self.external_bang,
89 self.redirect_to_first_result,
90 )
91

References searx.search.checker.impl.Checker.engineref_list(), searx.search.models.SearchQuery.engineref_list, searx.query.RawTextQuery.external_bang, searx.search.models.SearchQuery.external_bang, searx.format, searx.search.models.SearchQuery.lang, searx.search.models.SearchQuery.pageno, searx.query.RawTextQuery.query, searx.search.models.SearchQuery.query, searx.query.RawTextQuery.redirect_to_first_result, searx.search.models.SearchQuery.redirect_to_first_result, searx.search.models.SearchQuery.safesearch, searx.search.models.SearchQuery.time_range, searx.query.RawTextQuery.timeout_limit, and searx.search.models.SearchQuery.timeout_limit.

+ Here is the call graph for this function:

◆ categories()

searx.search.models.SearchQuery.categories ( self)

Definition at line 76 of file models.py.

76 def categories(self):
77 return list(set(map(lambda engineref: engineref.category, self.engineref_list)))
78

References searx.search.checker.impl.Checker.engineref_list(), and searx.search.models.SearchQuery.engineref_list.

+ Here is the call graph for this function:

Member Data Documentation

◆ __slots__

tuple searx.search.models.SearchQuery.__slots__
staticprivate
Initial value:
= (
'query',
'engineref_list',
'lang',
'locale',
'safesearch',
'pageno',
'time_range',
'timeout_limit',
'external_bang',
'engine_data',
'redirect_to_first_result',
)

Definition at line 30 of file models.py.

◆ engine_data

searx.search.models.SearchQuery.engine_data = engine_data or {}

Definition at line 65 of file models.py.

Referenced by searx.search.models.SearchQuery.__copy__().

◆ engineref_list

◆ external_bang

searx.search.models.SearchQuery.external_bang = external_bang

◆ lang

◆ locale

searx.search.models.SearchQuery.locale = None

◆ pageno

◆ query

◆ redirect_to_first_result

searx.search.models.SearchQuery.redirect_to_first_result = redirect_to_first_result

◆ safesearch

◆ time_range

◆ timeout_limit

searx.search.models.SearchQuery.timeout_limit = timeout_limit

The documentation for this class was generated from the following file: