[GMG-Devel] [PATCH 08/83] Add schemas.py which will store all index schemas.

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


From: Praveen Kumar <praveen97uma at gmail.com>

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

diff --git a/mediagoblin/plugins/search/schemas.py b/mediagoblin/plugins/search/schemas.py
new file mode 100644
index 0000000..405cf35
--- /dev/null
+++ b/mediagoblin/plugins/search/schemas.py
@@ -0,0 +1,28 @@
+from whoosh.fields import Schema
+from whoosh.fields import ID
+from whoosh.fields import TEXT
+from whoosh.fields import DATETIME
+
+
+class MediaEntrySearchSchema(Schema):
+    """
+    Represents the schema of the search index corresponding 
+    to db.models.MediaEntry objects.
+    """
+    # id of the media entry object. this field is indexed
+    # and is set to be unique so as to facilitate updating
+    # of existing documents in the index
+    id = ID(unique=True)
+
+    # stores same value as that of id but is stored with the index
+    # we need this value if we want to retrieve objects from db
+    id_stored = ID(stored=True)
+
+    uploader = TEXT
+    title = TEXT
+    slug = TEXT
+    created = DATETIME
+    description = TEXT
+    media_type = TEXT
+    license = TEXT
+
-- 
1.8.5.3



More information about the devel mailing list