[Xapian-discuss] Read accesses through WritableDatabase are slow

Olly Betts olly at survex.com
Mon Oct 23 20:56:59 BST 2006


On Mon, Oct 23, 2006 at 04:23:45PM +0200, Jean-Francois Dockes wrote:
> Writes happen even when there are no modifications to the index (all files
> up to date).

That's a bug.  The attached patch should fix it.

> If somebody has already solved this problem in a different way, or has an
> idea, I'd sure be glad to hear about it...  

I'd go with the approach James suggests - add the same term to all the
Xapian documents generated from a particular source document.  It's
better to use a single term's posting list to store a list of documents
than store it using one term per document.

Cheers,
    Olly
-------------- next part --------------
Index: backends/flint/flint_database.cc
===================================================================
--- backends/flint/flint_database.cc	(revision 7356)
+++ backends/flint/flint_database.cc	(working copy)
@@ -1040,8 +1040,9 @@
     DEBUGCALL(DB, TermList *, "FlintWritableDatabase::open_allterms", "");
     if (transaction_active())
 	throw Xapian::UnimplementedError("Can't open allterms iterator during a transaction");
-    // Terms may have been added or removed, so we need to flush.
-    do_flush_const();
+    // If there are changes, terms may have been added or removed, and so we
+    // need to flush.
+    if (changes_made) do_flush_const();
     RETURN(new FlintAllTermsList(Xapian::Internal::RefCntPtr<const FlintWritableDatabase>(this),
 				 &database_ro.postlist_table));
 }


More information about the Xapian-discuss mailing list