[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GMG-Devel] [PATCH 07/83] Fix imports and other bugs in indices.py
From: |
Alon Levy |
Subject: |
[GMG-Devel] [PATCH 07/83] Fix imports and other bugs in indices.py |
Date: |
Tue, 25 Feb 2014 21:57:50 +0200 |
From: Praveen Kumar <address@hidden>
---
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
- [GMG-Devel] [PATCH 00/83] Search plugin, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 01/83] Register search plugin with mediagoblin.ini, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 02/83] Correct indices storage dictionary in config_spec.ini, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 03/83] Refactor exceptions raised by the search plugin, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 04/83] Fix typos in search.models, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 05/83] Rename models.py to indices.py as these will not be stored in db., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 06/83] Remove global constants from the top of indices.py, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 07/83] Fix imports and other bugs in indices.py,
Alon Levy <=
- [GMG-Devel] [PATCH 08/83] Add schemas.py which will store all index schemas., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 09/83] Store also the field names in the SearchIndex object which is also necessary while searching., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 10/83] Correct the class index schema class., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 11/83] Add indexer for MediaEntry objects., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 12/83] Add IndexRegistry class to maintain the search indices., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 13/83] Clean up plugins.search.indices, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 14/83] Rename base.py to registry.py and indices.py to base.py., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 15/83] Add index identifier to SearchIndex., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 16/83] Correct the index identifier., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 17/83] Collect all indices in indices.py, Alon Levy, 2014/02/25