olivernn
Joined 16 years ago
Joined 16 years ago
I'm also interested in _why_ that is quicker though, aren't all object keys converted to strings anyway?
Switching to a trie-like structure that compresses prefixes and suffixes can lead to significant savings. Building the structure can be a bit more burdensome, so there is a trade off there. There is a paper describing the approach [2] and, if you're interested, my JavaScript implementation [3][4].
[2] http://www.aclweb.org/anthology/J00-1002.pdf
[3] https://github.com/olivernn/lunr.js/blob/master/lib/token_se...
[4] https://github.com/olivernn/lunr.js/blob/master/lib/token_se...
I'll have to take a look and see what @weixsong added, perhaps there are some changes that I can merge upstream.
[1] https://github.com/weixsong/elasticlunr.js/graphs/contributo...
* http://reyesr.github.io/fullproof/ * http://www.tipue.com/search/
Might be interesting to see how these also stack up.
In the future I want to add even more powerful querying, restricting search to specific fields, taking into account the distance between terms, and adding faceted search to reduce the total documents being searched over.
One of the original goals of the project was specifically to provide a better alternative to just using the browsers built in find-in-page functionality
If indexing performance starts to become an issue the whole search index can be moved into a web-worker, which prevents indexing from blocking the rest of the page.