diff --git a/Readme.md b/Readme.md index 0d18b3b..255f8f6 100644 --- a/Readme.md +++ b/Readme.md @@ -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) diff --git a/cherche.js b/cherche.js index c2f1b5f..c4c3c2a 100644 --- a/cherche.js +++ b/cherche.js @@ -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));