[Xapian-devel] Searching without flush?

Olly Betts olly at survex.com
Sun Aug 22 01:51:04 BST 2004

On Tue, Jun 01, 2004 at 12:51:42PM +0100, Olly Betts wrote:
> On Tue, Jun 01, 2004 at 12:06:47PM +0200, Robert Pollak wrote:
> > I am using the same Xapian::WritableDatabase instance for indexing
> > and searching.
> > 
> > Currently each search causes a database flush, which is slow.
> > How can I avoid this flush?

> There are two things which a search does which will cause a flush.  The
> first is opening posting lists for the terms in the search.  If any of
> the search terms was in a document added, removed, or modified since
> the last flush, quartz will flush.
> The other is calculating the average document length.
> [...]
> If you really need to do a search, a boolean search would avoid the need
> to calculate the average document length, so will avoid flushing except
> when you search for a term used in a recent change.

I've just improved WritableDatabase to calculate the average document
length without forcing a flush, so searching a modified WritableDatabase
will only force a flush if the search includes a term whose posting list
has pending modifications.


More information about the Xapian-devel mailing list