olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.96k stars 548 forks source link

bug fix for lunr.index.search throws TypeError when searching for "javas... #13

Closed makoto closed 11 years ago

makoto commented 11 years ago

The bug fix for https://github.com/olivernn/lunr.js/issues/12 .

mpneuried commented 11 years ago

I run into the same problem. If you try to search for more than one word and the first word will not create a result you get an error like:

TypeError: invalid 'in' operand root has(token="", root=1) in lunr.js (1185)

My Solution in lunr.js (1180) is

  var root = typeof(root) != "object" ? this.root : root,

This takes care of the var scope

olivernn commented 11 years ago

The problem was actually a little further up than the token store, where the error was being thrown. I've pushed a new version with a fix. Thanks