Pārlūkot izejas kodu

Add suffix compatibility

jcherqui 7 gadus atpakaļ
vecāks
revīzija
dbf7901711
1 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. 8
    0
      searx/query.py

+ 8
- 0
searx/query.py Parādīt failu

@@ -93,6 +93,14 @@ class RawTextQuery(object):
93 93
                         if lang == lang_id:
94 94
                             break
95 95
 
96
+            # this force a engine
97
+            suffix = raw_query_parts[-1:][0]
98
+            if suffix[0] == '!':
99
+                suffix = suffix.replace('!', '')
100
+                if suffix in engine_shortcuts:
101
+                    self.engines.append({'category': 'none', 'name': engine_shortcuts[suffix]})
102
+                    self.specific = True
103
+
96 104
             # this force a engine or category
97 105
             if query_part[0] == '!' or query_part[0] == '?':
98 106
                 prefix = query_part[1:].replace('-', ' ').replace('_', ' ')