[Xapian-discuss] Question on "single writer, multiple reader"

James Aylett james-xapian at tartarus.org
Sun Jan 18 16:25:29 GMT 2015


On 16 Jan 2015, at 07:39, Gang Chen <pkuchengang at gmail.com> wrote:

> I've been using Xapian in my project recently. The feature "single
> writer, multiple reader" is one of my favorite, but currently I can't make
> it work.
> 
> With the search process alive, I added some new documents into the
> database, but I can't retrieve them on the search process. However, if I
> stop the search process and restart it again, I can retrieve those new ones.

That’s exactly how it’s supposed to work. “Eventually” (once the writer gets sufficiently far ahead of the reader), the reader will get a DatabaseModifiedError and will have to re-open the database, but until then it’s up to it when it does so. You may wish to do it every N requests, or every K seconds, or only when you have to handle DatabaseModifiedError; it’s up to you.

We have a note that some more detailed documentation around this would be helpful. For now, the following should be useful: <https://getting-started-with-xapian.readthedocs.org/en/latest/concepts/indexing/databases.html?highlight=databasemodifiederror#concurrent-access>.

J

-- 
 James Aylett, occasional trouble-maker
 xapian.org




More information about the Xapian-discuss mailing list