Browse Source

Add suffix compatibility

jcherqui 7 years ago
parent
commit
dbf7901711
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      searx/query.py

+ 8
- 0
searx/query.py View File

93
                         if lang == lang_id:
93
                         if lang == lang_id:
94
                             break
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
             # this force a engine or category
104
             # this force a engine or category
97
             if query_part[0] == '!' or query_part[0] == '?':
105
             if query_part[0] == '!' or query_part[0] == '?':
98
                 prefix = query_part[1:].replace('-', ' ').replace('_', ' ')
106
                 prefix = query_part[1:].replace('-', ' ').replace('_', ' ')