olivernn / lunr.js

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

Mark Builder.build() as public API to support custom Index creation #293

Closed seantanly closed 7 years ago

seantanly commented 7 years ago

I have a large number of documents that is pulled async from local storage that needs to be indexed for search. While building lunr.Index, I would like to pull the documents out by smaller chunks instead of everything into memory to make use of the convenience index creation function lunr.

With the removal of mutable index, and the function lunrbeing synchronous, I would need to Builder.build() function to be officially supported public API, to enable async building of the lunr.Index.

https://github.com/olivernn/lunr.js/blob/e2031f44f3b852f5821156cc2d966b972802e649/lib/builder.js#L272

olivernn commented 7 years ago

I'm not sure why that method is marked as private, I can't think of any reason why it should be. Perhaps I was trying to protect people from calling build within the function passed to the lunr convenience helper?

PR's welcome btw 😉

olivernn commented 7 years ago

I've merged your changes and pushed a new release 2.1.3.

Thanks for taking the time to open the issue and send the PR!

seantanly commented 7 years ago

Thanks for making the new release! It will be perfect when the JSDoc for Builder gets updated. :)

https://lunrjs.com/docs/lunr.Builder.html

olivernn commented 7 years ago

Was likely just a caching issue, I'm pretty sure the docs are re-built and published by travis after a build on master. It's showing up for me now anyway, let me know if you still don't see it.

seantanly commented 7 years ago

You're right, force refreshing my browser shows the latest version. 👍