Exact search checkbox removed, search now works as follows:
- you can use * or % as wildcard
- with no wildcard, substring search is performed (same as *item*)
- wildcard can be in the middle of search query (e.g. python*fc22)
kparal | |
jskladan |
Exact search checkbox removed, search now works as follows:
$ python runapp.py nad try it
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | resultsdb_frontend/static/js/search.js (19 lines) | |||
M | resultsdb_frontend/templates/layout.html (4 lines) |
Commit | Tree | Parents | Author | Summary | Date |
---|---|---|---|---|---|
205d8efaf222 | 092f587734c5 | d51185bcef54 | Lukas Brabec | Search improvement (Show More…) | Jul 7 2015, 8:23 AM |
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 41 | ).on('click', function(){ | |||
---|---|---|---|---|---|
42 | $(".popover #query").focus(); | 42 | $(".popover #query").focus(); | ||
43 | $(".popover #searchform").submit(function(e){ | 43 | $(".popover #searchform").submit(function(e){ | ||
44 | 44 | | |||
45 | var query = $(".popover #query").val(); | 45 | var query = $(".popover #query").val(); | ||
46 | var testcase = $(".popover #testcase").val(); | 46 | var testcase = $(".popover #testcase").val(); | ||
47 | var type = $(".popover #type").val(); | 47 | var type = $(".popover #type").val(); | ||
48 | var url = $(".popover #url").val() + "?" | 48 | var url = $(".popover #url").val() + "?" | ||
49 | 49 | | |||
50 | if(query != "") | 50 | | ||
51 | if($(".popover #exact").prop('checked')) | 51 | query = query.replace(/\*/g,"%"); | ||
52 | url += "item="+query; | 52 | | ||
53 | else | 53 | if(query.includes("%")){ | ||
54 | url += "item:like="+query+"%"; | 54 | //wildcard match | ||
55 | url += "item:like=" + query; | ||||
56 | } else { | ||||
57 | //substring match | ||||
58 | url += "item:like=%" + query + "%"; | ||||
59 | } | ||||
55 | 60 | | |||
56 | if(testcase != 0) | 61 | if(testcase != 0) | ||
57 | url += "&testcase_name="+testcase; | 62 | url += "&testcase_name="+testcase; | ||
58 | if(type != 0) | 63 | if(type != 0) | ||
59 | url += "&type="+type; | 64 | url += "&type="+type; | ||
60 | 65 | | |||
61 | e.preventDefault(); | 66 | e.preventDefault(); | ||
62 | 67 | | |||
63 | //progressbar(); | 68 | //progressbar(); | ||
64 | //$(".popover #searchform").hide(); | 69 | //$(".popover #searchform").hide(); | ||
65 | 70 | | |||
66 | window.location.href = url; | 71 | window.location.href = encodeURI(url); | ||
67 | }); | 72 | }); | ||
68 | }); | 73 | }); | ||
69 | 74 | | |||
70 | $(document).bind('keypress', function(e) { | 75 | $(document).bind('keypress', function(e) { | ||
71 | if(e.keyCode == 47 && !$(":focus").is("input")) //slash key | 76 | if(e.keyCode == 47 && !$(":focus").is("input")) //slash key | ||
72 | { | 77 | { | ||
73 | e.preventDefault(); | 78 | e.preventDefault(); | ||
74 | $("#popover").click(); | 79 | $("#popover").click(); | ||
75 | } | 80 | } | ||
76 | }); | 81 | }); | ||
77 | }); | 82 | }); | ||
78 | No newline at end of file | 83 | No newline at end of file |
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 77 | <form id="searchform" role="form" name="searchform" action=""> | |||
---|---|---|---|---|---|
92 | <div class="form-group"> | 92 | <div class="form-group"> | ||
93 | <select class="form-control" id="type"> | 93 | <select class="form-control" id="type"> | ||
94 | <option value="0">Any type</option> | 94 | <option value="0">Any type</option> | ||
95 | <option value="koji_build">Koji build</option> | 95 | <option value="koji_build">Koji build</option> | ||
96 | <option value="bodhi_update">Bodhi update</option> | 96 | <option value="bodhi_update">Bodhi update</option> | ||
97 | <option value="koji_tag">Koji tag</option></select> | 97 | <option value="koji_tag">Koji tag</option></select> | ||
98 | </div> | 98 | </div> | ||
99 | 99 | | |||
100 | <div class="form-group"> | | |||
101 | <label class="checkbox-inline"><input type="checkbox" id="exact" value="option1" checked> Exact search (faster)</label> | | |||
102 | </div> | | |||
103 | | ||||
104 | <button type="submit" class="btn btn-default" id="go">Go!</button> | 100 | <button type="submit" class="btn btn-default" id="go">Go!</button> | ||
105 | </form> | 101 | </form> | ||
106 | <div id="progressbar-animation" class="hide" style="width:200px;"></div> | 102 | <div id="progressbar-animation" class="hide" style="width:200px;"></div> | ||
107 | </div> | 103 | </div> | ||
108 | </div> | 104 | </div> | ||
109 | 105 | | |||
110 | </body> | 106 | </body> | ||
111 | </html> | 107 | </html> |