olivernn/lunr.js — pull request #114 by alex2 (2014-10-18 13:49:39+00:00)
Title: Manually set document store length on set()

Repeatedly calling ``Object.keys(this.store).length`` is very expensive and dramatically slows the indexing process for larger data sets.

On my data set of around 15k items, this change reduces the index time from 23 seconds to 4.

Tests all still pass.

An alternative would be to make length a getter method which runs ``Object.keys(this.store).length``.

Thanks!