--- xapian.module.orig	2008-06-01 12:50:57.000000000 -0400
+++ xapian.module	2008-06-01 12:51:00.000000000 -0400
@@ -12,6 +12,9 @@
 
 include_once('xapian.php');
 
+define('XAPIAN_WRITABLE', TRUE);
+define('XAPIAN_FLUSH', TRUE);
+
 /**
  * Provide default error handler for xapian
  *
@@ -569,7 +572,7 @@
   static $stemmer;
   static $indexer;
 
-  $db = _xapian_init_database(TRUE);
+  $db = _xapian_init_database(XAPIAN_WRITABLE);
   if (!is_object($db)) {
     watchdog('xapian', t('Could not get writable database.'));
     return FALSE;
@@ -668,7 +671,7 @@
   if (variable_get('xapian_index_immediately', TRUE) == TRUE) {
     if (_xapian_reindex_node($node)) {
       // Flush the changes to disk.
-      _xapian_init_database(TRUE, TRUE);
+      _xapian_init_database(XAPIAN_WRITABLE, XAPIAN_FLUSH);
     }
     else {
       // Failed to update Xapian database, queue item to index later.
@@ -686,13 +689,13 @@
  * @param object $node
  */
 function xapian_remove_node_from_index($node) {
-  $db = _xapian_init_database(TRUE);
+  $db = _xapian_init_database(XAPIAN_WRITABLE);
   if ($db) {
     if (is_object($node)) {
       if ($node->nid) {
         $db->delete_document('Q'. $node->nid);
         // Flush the changes to disk.
-        _xapian_init_database(TRUE, TRUE);
+        _xapian_init_database(XAPIAN_WRITABLE, XAPIAN_FLUSH);
       }
     }
   }
@@ -735,7 +738,7 @@
     }
   }
   // Flush the changes to disk.
-  _xapian_init_database(TRUE, TRUE);
+  _xapian_init_database(XAPIAN_WRITABLE, XAPIAN_FLUSH);
   
   if (variable_get('xapian_log_queries', FALSE)) {
     $time_taken = (microtime(TRUE) - $start_time) * 1000;
