[GMG-Devel] [PATCH 17/83] Collect all indices in indices.py

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


From: Praveen Kumar <praveen97uma at gmail.com>

---
 mediagoblin/plugins/search/indices.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 mediagoblin/plugins/search/indices.py

diff --git a/mediagoblin/plugins/search/indices.py b/mediagoblin/plugins/search/indices.py
new file mode 100644
index 0000000..c329961
--- /dev/null
+++ b/mediagoblin/plugins/search/indices.py
@@ -0,0 +1,23 @@
+import logging
+
+from mediagoblin.db.models import MediaEntry
+
+from mediagoblin.plugins.search import schemas
+from mediagoblin.plugins.search.base import SearchIndex
+from mediagoblin.plugins.search import registry
+
+_log = logging.getLogger(__name__)
+
+media_entry_search_index = SearchIndex(
+    model = MediaEntry,
+    schema = schemas.MediaEntryIndexSchema,
+)
+
+
+def register_indices():
+    registry.IndexRegistry.register(media_entry_search_index)
+    _log.info("Registered %(index_name)s index for %(model_name)s"%({
+        'index_name': media_entry_search_index.__class__.__name__,
+        'model_name': MediaEntry.__class__.__name__}))
+
+
-- 
1.8.5.3



More information about the devel mailing list