log_search.py
changeset 96 d30c88e89a7e
parent 93 48fca00689e3
child 99 8719ac564b22
--- a/log_search.py	Wed Feb 11 02:21:43 2009 +0200
+++ b/log_search.py	Wed Feb 11 03:04:35 2009 +0200
@@ -7,7 +7,7 @@
 
 import HyperEstraier as hype
 
-import log_line, utils
+import log_line, utils, config
 
 class LogSearchError (Exception) :
     """
@@ -304,3 +304,21 @@
             max         = count,
             skip        = skip
         )
+
+# global read-only index
+_index = None
+
+def get_index () :
+    """
+        Returns the default read-only index, suitable for searching
+    """
+    
+    global _index
+    
+    # open?
+    if not _index :
+        _index = LogSearchIndex(config.LOG_CHANNELS, config.SEARCH_INDEX_PATH, 'r')
+
+    # return
+    return _index
+