I understand that it is possible to use the stale option to return less than accurate result while an index is being built. However, I would like to know if there's a way to tell if PouchDb is actively building an index, so that I can notify the user that the result may not be 100% accurate.
1 Answer
No, there's no way to tell that.
But it also doesn't matter, your results will not be inaccurate. Rather, the query that triggers a re-indexing will block until the index is built.
So your concern to "notify the user that the result may not be 100% accurate" is unfounded.
There is another concern, though, and you can find many discussions of it on SO and elsewhere, and that is that the initial (re-)indexing after mass updates can take a while. To solve this many people suggest doing a dummy query immediately after a bulk update, to get the re-indexing out of the way. This may or may not apply to your application design.
-
So your concern to "notify the user that the result may not be 100% accurate" is unfounded. The reason why I said that is because according to the API reference [link](pouchdb.com/api.html#query_index ), if stale is set to OK, PouchDB will returns results immediately, even if they’re out-of-date. So, it's possible that it will return matches that have been changed, removed, etc. Jun 21, 2017 at 16:10
-
@toyssamurai: That's apparently unique to the pouchdb-find plugin. AFAIK, there's no way to do that with the traditional view queries. If that concerns you, I suggest not setting
stale: ok
:) Jun 23, 2017 at 15:28