[GMG-Devel] [PATCH 37/83] Register schemas for MediaEntry and MediaTag.

Alon Levy alon at pobox.com
Tue Feb 25 14:58:20 EST 2014


From: Praveen Kumar <praveen97uma at gmail.com>

---
 mediagoblin/plugins/search/__init__.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/mediagoblin/plugins/search/__init__.py b/mediagoblin/plugins/search/__init__.py
index c04956c..8be286d 100644
--- a/mediagoblin/plugins/search/__init__.py
+++ b/mediagoblin/plugins/search/__init__.py
@@ -19,9 +19,9 @@ import logging
 
 from mediagoblin.tools import pluginapi
 
-from mediagoblin.db.models import MediaEntry
+from mediagoblin.db.models import (MediaEntry, MediaTag)
 from mediagoblin.plugins.search import schemas
-from mediagoblin.plugins.search.base import SearchIndex
+from mediagoblin.plugins.search import indices
 from mediagoblin.plugins.search import registry
 from mediagoblin.plugins.search import listeners
 
@@ -31,7 +31,7 @@ PLUGIN_DIR = os.path.dirname(__file__)
 
 
 def register_indices():
-    media_entry_search_index = SearchIndex(
+    media_entry_search_index = indices.MediaEntrySearchIndex(
         model = MediaEntry,
         schema = schemas.MediaEntryIndexSchema,
     )
@@ -40,7 +40,15 @@ def register_indices():
     _log.info("Registered %(index_name)s index for %(model_name)s"%({
         'index_name': media_entry_search_index.__class__.__name__,
         'model_name': MediaEntry.__name__}))
-
+    
+    media_tag_search_index = indices.MediaTagSearchIndex(
+        model = MediaTag,
+        schema = schemas.MediaTagIndexSchema,
+    )
+    registry.IndexRegistry.register(media_tag_search_index)
+    _log.info("Registered %(index_name)s index for %(model_name)s"%({
+        'index_name': media_tag_search_index.__class__.__name__,
+        'model_name': MediaTag.__name__}))
 
 def activate_orm_events_listeners():
     indices = registry.IndexRegistry.indices()
-- 
1.8.5.3



More information about the devel mailing list