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

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)
 

Protected Member Functions

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

Additional Inherited Members

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

Detailed Description

Definition at line 43 of file query.py.

Member Function Documentation

◆ __call__()

searx.query.TimeoutParser.__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 48 of file query.py.

48 def __call__(self, raw_value):
49 value = raw_value[1:]
50 found = self._parse(value) if len(value) > 0 else False
51 if self.enable_autocomplete and not value:
52 self._autocomplete()
53 return found
54

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

+ Here is the call graph for this function:

◆ _autocomplete()

searx.query.TimeoutParser._autocomplete ( self)
protected

Definition at line 67 of file query.py.

67 def _autocomplete(self):
68 for suggestion in ['<3', '<850']:
69 self._add_autocomplete(suggestion)
70
71

References searx.query.QueryPartParser._add_autocomplete().

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

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

◆ _parse()

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

Definition at line 55 of file query.py.

55 def _parse(self, value):
56 if not value.isdigit():
57 return False
58 raw_timeout_limit = int(value)
59 if raw_timeout_limit < 100:
60 # below 100, the unit is the second ( <3 = 3 seconds timeout )
61 self.raw_text_query.timeout_limit = float(raw_timeout_limit)
62 else:
63 # 100 or above, the unit is the millisecond ( <850 = 850 milliseconds timeout )
64 self.raw_text_query.timeout_limit = raw_timeout_limit / 1000.0
65 return True
66

References searx.query.QueryPartParser.raw_text_query.

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

+ Here is the caller graph for this function:

◆ check()

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

Reimplemented from searx.query.QueryPartParser.

Definition at line 45 of file query.py.

45 def check(raw_value):
46 return raw_value[0] == '<'
47

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