Skip to content

Commit

Permalink
Fixes hound-search#45 by simply answering the empty query in the fron…
Browse files Browse the repository at this point in the history
…tend with

an empty result set.
  • Loading branch information
kellegous committed Jan 31, 2015
1 parent 6ef3168 commit ede81c3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pub/assets/js/hound.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ var Model = {

_this.params = params;

// An empty query is basically useless, so rather than
// sending it to the server and having the server do work
// to produce an error, we simply return empty results
// immediately in the client.
if (params.q == '') {
_this.results = [];
_this.resultsByRepo = {};
_this.didSearch.raise(_this, _this.Results);
return;
}

$.ajax({
url: '/api/v1/search',
data: params,
Expand Down

0 comments on commit ede81c3

Please sign in to comment.