.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)
 
- Static Public Member Functions inherited from searx.query.QueryPartParser

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 = raw_text_query
 
 enable_autocomplete = enable_autocomplete
 

Detailed Description

Definition at line 44 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 49 of file query.py.

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

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

+ Here is the call graph for this function:

◆ _autocomplete()

searx.query.TimeoutParser._autocomplete ( self)
protected

Definition at line 68 of file query.py.

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

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.TimeoutParser._parse ( self,
value )
protected

Definition at line 56 of file query.py.

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

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.TimeoutParser.check ( raw_value)
static
Check if raw_value can be parsed

Reimplemented from searx.query.QueryPartParser.

Definition at line 46 of file query.py.

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

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