From 0030bcd3ec47cde85feea6a64c479d84046064a0 Mon Sep 17 00:00:00 2001 From: Lukas Brabec Date: Jul 07 2015 08:29:32 +0000 Subject: Search improvement Summary: 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`) Test Plan: `$ python runapp.py` nad try it Reviewers: kparal, jskladan Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D416 --- diff --git a/resultsdb_frontend/static/js/search.js b/resultsdb_frontend/static/js/search.js index b345e04..42fc3e6 100644 --- a/resultsdb_frontend/static/js/search.js +++ b/resultsdb_frontend/static/js/search.js @@ -47,23 +47,28 @@ $(function() { var type = $(".popover #type").val(); var url = $(".popover #url").val() + "?" - if(query != "") - if($(".popover #exact").prop('checked')) - url += "item="+query; - else - url += "item:like="+query+"%"; + query = query.replace(/\*/g,"%"); + + if(query.includes("%")){ + //wildcard match + url += "item:like=" + query; + } else { + //substring match + url += "item:like=%" + query + "%"; + } + if(testcase != 0) url += "&testcase_name="+testcase; if(type != 0) url += "&type="+type; - + e.preventDefault(); //progressbar(); //$(".popover #searchform").hide(); - window.location.href = url; + window.location.href = encodeURI(url); }); }); diff --git a/resultsdb_frontend/templates/layout.html b/resultsdb_frontend/templates/layout.html index 72b573f..49fa1d7 100644 --- a/resultsdb_frontend/templates/layout.html +++ b/resultsdb_frontend/templates/layout.html @@ -97,10 +97,6 @@ -
- -
-