Node bindings
I started to work on node bindings for tantivy:
tantivy-node
Very basic still, but works. I'm new to rust and writing bindings, so if anyone wants to follow along or chime in feel free to!
First of all that's awesome! Thank you for driving that effort.
A couple of comment. It is a bad idea to commit after adding each document. Inserts are meant to be batched.
You shouldn't create and drop the IndexWriter everything time.
On drop, you non-commited documents are lost.
I suggest either mimicking tantivy's API, or adding a IndexWriter field to your JsIndex.
One problem with this approach is that you will only be able to create one processor
reading the index at the same time. Maybe you could make that IndexWriter and Option<IndexWriter>, only populate it, when the index is opened as writable, and throw everytime someone tries to add a doc or delete a term on a readonly segment.
@Frando also, do you need help for this?
Thanks for the feedback!
I'm using this as a rust learning excercise for now. I reworked the whole project to use https://github.com/cztomsik/napi-rs in place of neon. Seems much leaner to work with, and neon does still not support n-api.
Pushed my changes to https://github.com/Frando/tantivy-node, still very basic (needs some high-level js wrapping also, but that's easy to do).
I added another commit. Now has a test and a proper JS api. Still quite basic, but should be usable.
Biggest "bug" at the moment is that the IndexWriter lock is not cleared. The lock is cleared when the IndexWriter is dropped, right? If so I'd guess that the napi-rs bindings don't properly implement the finalizecallback from n-apiwhich could lead to the IndexWriter never being properly dropped - but I'm not sure.
Is there any usable node bindings now? It's super awesome if tantivy can be used with Node.js