[GMG-Devel] [PATCH 09/83] Store also the field names in the SearchIndex object which is also necessary while searching.

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


From: Praveen Kumar <praveen97uma at gmail.com>

---
 mediagoblin/plugins/search/indices.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mediagoblin/plugins/search/indices.py b/mediagoblin/plugins/search/indices.py
index c33bf70..086271b 100644
--- a/mediagoblin/plugins/search/indices.py
+++ b/mediagoblin/plugins/search/indices.py
@@ -21,6 +21,7 @@ class SearchIndex(object):
     
     def __init__(self, search_index_dir=None, use_multiprocessing=None):
         self.schema = None
+        self.field_names = None
         self.search_index = None
         self.search_index_name = self.__class__.__name__.lower()
         
@@ -75,7 +76,9 @@ class SearchIndex(object):
 
         self.search_index = whoosh.index.create_in(self.search_index_dir,
                 indexname=self.search_index_name, schema=schema)
-         
+        
+        self.field_names = schema.names()
+
     def add_document(self, **document):
         """
         Adds a document to the index represented by this class.
-- 
1.8.5.3



More information about the devel mailing list