Quick search to not include closed cases by default - FogBugz Knowledge Exchange most recent 30 from http://fogbugz.stackexchange.com 2013-05-19T07:27:09Z http://fogbugz.stackexchange.com/feeds/question/10628 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://fogbugz.stackexchange.com/questions/10628/quick-search-to-not-include-closed-cases-by-default Quick search to not include closed cases by default Peter 2012-07-24T10:39:00Z 2012-08-16T14:13:31Z <p>Searching in FogBugz today using the quick search box will search in all content, including closed cases. Closed cases are in 90% of our cases not of interest anymore. I know we can add e.g. "status:open" to narrow the result, but since we mostly want this behavior, is there a way to configure this as a default? </p> <p>If not, this is a most-wanted feature :)</p> http://fogbugz.stackexchange.com/questions/10628/quick-search-to-not-include-closed-cases-by-default/10629#10629 Answer by db for Quick search to not include closed cases by default db 2012-07-24T13:17:37Z 2012-08-16T14:13:31Z <p>There is not currently an option to configure search to exclude closed cases by default.</p> <p>As a workaround, the following <a href="http://fogbugz.stackexchange.com/questions/5520" rel="nofollow">BugMonkey</a> customization will automatically append " status:active" to your search box when you submit your search request:</p> <pre><code>name: Search only active cases by default description: Modifies the search box to only search for active cases by default author: Dane Bertram version: 1.0.1.0 js: $('#frmSearch').on('submit', function() { var jSearchFor = $('#searchFor'); var search = jSearchFor.val(); if (search.toLowerCase().indexOf('status:') === -1 &amp;&amp; !/^\d+$/.test(search.trim())) { jSearchFor.val(search + ' status:active'); } }); </code></pre> <p>Note that this customization will only append " status:active" if your customer search</p> <ol> <li><em>doesn't</em> already include a "status:" clause AND</li> <li><em>isn't</em> just a case number (i.e., you're trying to do a quick case lookup)</li> </ol> http://fogbugz.stackexchange.com/questions/10628/quick-search-to-not-include-closed-cases-by-default/10714#10714 Answer by Peter for Quick search to not include closed cases by default Peter 2012-08-16T07:32:54Z 2012-08-16T07:39:01Z <p>The BugMonkey script proposed by @db breaks quick lookup on case id. Here's an extended version that alleviates that issue:</p> <pre><code>name: Search only active cases by default description: Modifies the search box to only search for active cases by default. Will only add the status axis if the search is not a number. author: Dane Bertram version: 1.0.0.1 js: $('#frmSearch').on('submit', function() { var jSearchFor = $('#searchFor'); var searchForVal = jSearchFor.val(); if (searchForVal.indexOf(' ') === -1) { var number = parseInt(searchForVal, 10); if (!isNan(number)) return; } if (searchForVal.indexOf('status:') === -1) { jSearchFor.val(searchForVal + ' status:active'); } }); </code></pre>