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

lunr.Index.prototype.idf() seems to fail when the term is an all-lowercase property of Object.prototype. #64

Closed gitgrimbo closed 9 years ago

gitgrimbo commented 10 years ago

For example, an index with "constructor" or "UNDERUNDERprotoUNDERUNDER" terms in it will cause idf() to return the Object.prototype property of the same name.

(UNDER is _. Used here to avoid GFM stripping the _s and turning the property bold)

Because the returned property of Object.prototype is not a number, the subsequent calculations return NaN.

Pull request with tests to follow.

olivernn commented 9 years ago

I believe this is now fixed

Please re-open if you continue to see any problems.