Bugfix: don't search for empty string
This commit is contained in:
parent
147e77d774
commit
be3b512204
2 changed files with 3 additions and 1 deletions
|
@ -21,6 +21,7 @@ Todo (sorted by priority)
|
|||
0. ~~Make the search case-insensitive (as well as accents insensitive)~~
|
||||
0. ~~BUG: trim spaces from search expression~~
|
||||
0. ~~BUG: fix search for codes also~~
|
||||
0. ~~BUG: don't search for empty string~~
|
||||
0. Create a nice html page (may take several steps)
|
||||
0. Make it chrome compatible (some trouble with the first ajax call)
|
||||
0. Make the search mis-spelling safe (like Google does)
|
||||
|
|
|
@ -211,7 +211,8 @@ function main() {
|
|||
//console.log(words.data);
|
||||
$( "#question" ).keyup(function () {
|
||||
var str = removeDiacritics($( "#question" ).val());
|
||||
var ans = words.find({'Word': { '$contains': str.trim()}});
|
||||
var cleanstr = str ? str.trim() : null;
|
||||
var ans = words.find({'Word': { '$contains': cleanstr }});
|
||||
//console.log("Words found: ",ans);
|
||||
//console.log(displayMany(ans));
|
||||
$( "#answer" ).empty().append(displayMany(ans));
|
||||
|
|
Loading…
Reference in a new issue