[GMG-Devel] [PATCH 07/83] Fix imports and other bugs in indices.py

Alon Levy alon at pobox.com
Tue Feb 25 14:57:50 EST 2014


From: Praveen Kumar <praveen97uma at gmail.com>

---
 mediagoblin/plugins/search/indices.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/mediagoblin/plugins/search/indices.py b/mediagoblin/plugins/search/indices.py
index e6e5c70..c33bf70 100644
--- a/mediagoblin/plugins/search/indices.py
+++ b/mediagoblin/plugins/search/indices.py
@@ -3,7 +3,9 @@ import os
 from mediagoblin.tools import pluginapi
 from mediagoblin.plugins.search.exceptions import IndexDoesNotExistsError
 
-from whoosh import index
+import whoosh
+
+from whoosh.filedb.multiproc import MultiSegmentWriter
 
 config = pluginapi.get_config('mediagoblin.plugins.search')
 
@@ -42,7 +44,7 @@ class SearchIndex(object):
             raise IndexDoesNotExistsError(
                 self.search_index_dir, self.search_index_name)
         
-        if self.index.exists_in(
+        if self.search_index.exists_in(
             self.search_index_dir, indexname=self.search_index_name):
             return True
 
@@ -71,8 +73,8 @@ class SearchIndex(object):
         if not os.path.exists(self.search_index_dir):
             os.mkdir(self.search_index_dir)
 
-        self.search_index = index.create_in(self.search_index_dir,
-                indexname=self.search_index_name)
+        self.search_index = whoosh.index.create_in(self.search_index_dir,
+                indexname=self.search_index_name, schema=schema)
          
     def add_document(self, **document):
         """
-- 
1.8.5.3



More information about the devel mailing list