.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.query.ExternalBangParser Class Reference
+ Inheritance diagram for searx.query.ExternalBangParser:
+ Collaboration diagram for searx.query.ExternalBangParser:

Public Member Functions

 __call__ (self, raw_value)
 
- Public Member Functions inherited from searx.query.QueryPartParser
 __init__ (self, raw_text_query, enable_autocomplete)
 

Static Public Member Functions

 check (raw_value)
 
- Static Public Member Functions inherited from searx.query.QueryPartParser

Public Attributes

 enable_autocomplete
 
- Public Attributes inherited from searx.query.QueryPartParser
 raw_text_query = raw_text_query
 
 enable_autocomplete = enable_autocomplete
 

Protected Member Functions

 _parse (self, value)
 
 _autocomplete (self, bang_ac_list)
 
- Protected Member Functions inherited from searx.query.QueryPartParser
 _add_autocomplete (self, value)
 

Detailed Description

Definition at line 152 of file query.py.

Member Function Documentation

◆ __call__()

searx.query.ExternalBangParser.__call__ ( self,
raw_value )
Try to parse raw_value: set the self.raw_text_query properties

return True if raw_value has been parsed

self.raw_text_query.autocomplete_list is also modified
if self.enable_autocomplete is True

Reimplemented from searx.query.QueryPartParser.

Definition at line 157 of file query.py.

157 def __call__(self, raw_value):
158 value = raw_value[2:]
159 found, bang_ac_list = self._parse(value) if len(value) > 0 else (False, [])
160 if self.enable_autocomplete:
161 self._autocomplete(bang_ac_list)
162 return found
163

References searx.query.BangParser._parse(), searx.query.ExternalBangParser._parse(), searx.query.LanguageParser._parse(), and searx.query.TimeoutParser._parse().

+ Here is the call graph for this function:

◆ _autocomplete()

searx.query.ExternalBangParser._autocomplete ( self,
bang_ac_list )
protected

Definition at line 172 of file query.py.

172 def _autocomplete(self, bang_ac_list):
173 if not bang_ac_list:
174 bang_ac_list = ['g', 'ddg', 'bing']
175 for external_bang in bang_ac_list:
176 self._add_autocomplete('!!' + external_bang)
177
178

References searx.query.QueryPartParser._add_autocomplete().

Referenced by searx.query.LanguageParser.__call__(), and searx.query.TimeoutParser.__call__().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _parse()

searx.query.ExternalBangParser._parse ( self,
value )
protected

Definition at line 164 of file query.py.

164 def _parse(self, value):
165 found = False
166 bang_definition, bang_ac_list = get_bang_definition_and_autocomplete(value)
167 if bang_definition is not None:
168 self.raw_text_query.external_bang = value
169 found = True
170 return found, bang_ac_list
171

References searx.query.QueryPartParser.raw_text_query.

Referenced by searx.query.BangParser.__call__(), searx.query.ExternalBangParser.__call__(), searx.query.LanguageParser.__call__(), and searx.query.TimeoutParser.__call__().

+ Here is the caller graph for this function:

◆ check()

searx.query.ExternalBangParser.check ( raw_value)
static
Check if raw_value can be parsed

Reimplemented from searx.query.QueryPartParser.

Definition at line 154 of file query.py.

154 def check(raw_value):
155 return raw_value.startswith('!!') and len(raw_value) > 2
156

Member Data Documentation

◆ enable_autocomplete

searx.query.ExternalBangParser.enable_autocomplete

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