diff --git a/core/search/js/search.js b/core/search/js/search.js index c7feeacf42e0..7defb0caea7a 100644 --- a/core/search/js/search.js +++ b/core/search/js/search.js @@ -294,6 +294,18 @@ }); $searchBox.keyup(function(event) { if (event.keyCode === 13) { //enter + var query = $searchBox.val(); + if (lastQuery !== query) { + currentResult = -1; + if (query.length > 2) { + self.search(query); + } else { + self.hideResults(); + } + if(self.hasFilter(getCurrentApp())) { + self.getFilter(getCurrentApp())(query); + } + } if(currentResult > -1) { var result = $searchResults.find('tr.result a')[currentResult]; window.location = $(result).attr('href'); @@ -308,19 +320,6 @@ currentResult++; renderCurrent(); } - } else { - var query = $searchBox.val(); - if (lastQuery !== query) { - currentResult = -1; - if (query.length > 2) { - self.search(query); - } else { - self.hideResults(); - } - if(self.hasFilter(getCurrentApp())) { - self.getFilter(getCurrentApp())(query); - } - } } }); $(document).keyup(function(event) { @@ -383,4 +382,4 @@ OC.search.customResults = {}; /** * @deprecated use get/setRenderer() instead */ -OC.search.resultTypes = {}; \ No newline at end of file +OC.search.resultTypes = {};