Browse Source

Add '?' bang to the autocompleter

Cqoicebordel 10 years ago
parent
commit
bc2d5bf88c
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      searx/autocomplete.py

+ 6
- 5
searx/autocomplete.py View File

@@ -35,13 +35,14 @@ def searx_bang(full_query):
35 35
     results = []
36 36
 
37 37
     # check if current query stats with !bang
38
-    if full_query.getSearchQuery()[0] == '!':
38
+    first_char = full_query.getSearchQuery()[0]
39
+    if first_char == '!' or first_char == '?':
39 40
         if len(full_query.getSearchQuery()) == 1:
40 41
             # show some example queries
41 42
             # TODO, check if engine is not avaliable
42
-            results.append("!images")
43
-            results.append("!wikipedia")
44
-            results.append("!osm")
43
+            results.append(first_char + "images")
44
+            results.append(first_char + "wikipedia")
45
+            results.append(first_char + "osm")
45 46
         else:
46 47
             engine_query = full_query.getSearchQuery()[1:]
47 48
 
@@ -61,7 +62,7 @@ def searx_bang(full_query):
61 62
                     results.append('!{engine_shortcut}'.format(engine_shortcut=engine_shortcut))
62 63
 
63 64
     # check if current query stats with :bang
64
-    elif full_query.getSearchQuery()[0] == ':':
65
+    elif first_char == ':':
65 66
         if len(full_query.getSearchQuery()) == 1:
66 67
             # show some example queries
67 68
             results.append(":en")