changeset 855:481c72d4a181

support for common indices directory cfg.xapian_index_dir
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Mon, 19 Jun 2006 09:53:52 +0200
parents 210f3adb44de
children e69f2c2a238d
files MoinMoin/Xapian.py MoinMoin/multiconfig.py docs/CHANGES.fpletz
diffstat 3 files changed, 43 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Xapian.py	Sun Jun 18 01:07:21 2006 +0200
+++ b/MoinMoin/Xapian.py	Mon Jun 19 09:53:52 2006 +0200
@@ -280,30 +280,35 @@
                        #Y   year (four digits)
     }
 
-
-
     class LockedException(Exception):
         pass
     
     def __init__(self, request):
         self.request = request
         cache_dir = request.cfg.cache_dir
-        self.main_dir = os.path.join(cache_dir, 'xapian')
-        self.dir = os.path.join(self.main_dir, 'index')
+        main_dir = self._main_dir()
+        self.dir = os.path.join(main_dir, 'index')
         filesys.makeDirs(self.dir)
-        self.sig_file = os.path.join(self.main_dir, 'complete')
-        lock_dir = os.path.join(self.main_dir, 'index-lock')
+        self.sig_file = os.path.join(main_dir, 'complete')
+        lock_dir = os.path.join(main_dir, 'index-lock')
         self.lock = lock.WriteLock(lock_dir,
                                    timeout=3600.0, readlocktimeout=60.0)
         self.read_lock = lock.ReadLock(lock_dir, timeout=3600.0)
-        self.queue = UpdateQueue(os.path.join(self.main_dir, "update-queue"),
-                                 os.path.join(self.main_dir, 'update-queue-lock'))
-        
+        self.queue = UpdateQueue(os.path.join(main_dir, 'update-queue'),
+                                 os.path.join(main_dir, 'update-queue-lock'))
+
         # Disabled until we have a sane way to build the index with a
         # queue in small steps.
         ## if not self.exists():
         ##    self.indexPagesInNewThread(request)
 
+    def _main_dir(self):
+        if self.request.cfg.xapian_index_dir:
+            return os.path.join(self.request.cfg.xapian_index_dir,
+                    self.request.cfg.siteid)
+        else:
+            return os.path.join(request.cfg.cache_dir, 'xapian')
+
     def exists(self):
         """ Check if index exists """        
         return os.path.exists(self.sig_file)
--- a/MoinMoin/multiconfig.py	Sun Jun 18 01:07:21 2006 +0200
+++ b/MoinMoin/multiconfig.py	Mon Jun 19 09:53:52 2006 +0200
@@ -481,6 +481,11 @@
             name = dirname + '_dir'
             if not getattr(self, name, None):
                 setattr(self, name, os.path.join(data_dir, dirname))
+
+        # common xapian index directory
+        if getattr(self, 'xapian_search', False):
+            name = 'xapian_index_dir'
+            setattr(self, name, getattr(self, name, None))
             
         # Try to decode certain names which allow unicode
         self._decode()
--- a/docs/CHANGES.fpletz	Sun Jun 18 01:07:21 2006 +0200
+++ b/docs/CHANGES.fpletz	Mon Jun 19 09:53:52 2006 +0200
@@ -15,14 +15,16 @@
       metadata)
     * Mockup the new search UI
     * Write/update documentation for all the new search stuff
-    * Wikifarms support (multiple indexes)
-    * Indexing and searching of Categories (new term prefix)
+    * Indexing and searching of categories (new term prefix)
     * Finish the stemming/matching stuff
 
   New Features:
     * Faster search thanks to Xapian
     * Searching for languages with new prefix lang/language, i.e. lang:de
       Note: Only available when Xapian is activated
+    * New config options:
+        xapian_search        (bool)     enables xapian-powered search
+        xapian_index_dir     (string)   directory for xapian indices 
   
   Bugfixes (only stuff that is buggy in moin/1.6 main branch):
     * ...
@@ -61,5 +63,24 @@
       advice on how to detect and match them reliably using the current
       framework
 
-2006-06-18
+2006-06-19
+    * Introducing xapian_index_dir as a global directory for multiple
+      xapian indices i.e. for wikifarms.
 
+      Layout:
+            xapian_index_dir/
+                siteid1/
+                    complete
+                    index/
+                    index-lock/
+                    update-queue-lock/
+                siteid2/
+                    complete
+                    index/
+                    index-lock/
+                    update-queue-lock/
+                ...
+
+        Possible extension: Xapian can handle multiple databases, maybe
+        allow searching across defined wikis on a wikifarm?
+