Best practice for indexing documents with CBLite .NET

Is it better to have a single instance per process of a view object for indexing documents, or is it acceptable to have multiple instances of a view running the same map function within the same process/AppDomain?

The underlying database only allows a single writer at a time, so only one View instance can update the view’s index. If you have multiple View instances and run queries on them simultaneously, one of them is going to beat the others to get the database lock; that one will update the index, and then when the transaction ends, the others will see that the index is up to date.

Multiple View objects can be used to parallelize queries, though, since the database does allow simultaneous readers. So once the index is up to date, the Queries from the different Views can run in parallel (within the limits of the OS’s disk I/O bandwidth, of course.)

Great, so it sounds more efficient to limit the indexing to a single instance.

Thanks for the detailed info.