Closed sanfilippopablo closed 9 years ago
There is no clear
method available on index to do this. If you want a fresh index you should just create a new, empty index. Outside of testing purposes I don't really see the need for such a function.
@olivernn I'm in need of this functionality because we load all documents into memory so they can be searched quickly, but we need a way to update the docs in memory by clearing the indexed data and reloading it.
@patrickml do you need to update all the documents at once, or individually?
You can update a single document in the index using the lunr.Index.prototype.update
method, this actually just removes and then re-adds the document.
If you are doing this in bulk then it really is simpler to just create a whole new index, is there something I missing that means this approach won't work for your use case?
I need this for testing purposes.