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

Fix bug when indexing a document with empty fields #31

Closed olivernn closed 11 years ago

olivernn commented 11 years ago

Updates to #28 which fixes #27.

This makes sure that documents with an empty field do not end up getting a NaN score when searching.

If a field has no tokens it should not contribute to the tf for that token, before it was and 0 / 0 leads to a NaN.