summaryrefslogtreecommitdiff
path: root/loader
diff options
context:
space:
mode:
Diffstat (limited to 'loader')
-rw-r--r--loader/lib/parser.py1
-rw-r--r--loader/lib/storage.py3
-rw-r--r--loader/sql/schema.sql3
3 files changed, 5 insertions, 2 deletions
diff --git a/loader/lib/parser.py b/loader/lib/parser.py
index 258cc2b..670a70c 100644
--- a/loader/lib/parser.py
+++ b/loader/lib/parser.py
@@ -18,6 +18,7 @@ class ArchivesParser(object):
def parse(self, stream):
self.msg = self.parser.parse(stream)
+ self.rawtxt = unicode(self.msg)
def is_msgid(self, msgid):
# Look for a specific messageid. This means we might parse it twice,
diff --git a/loader/lib/storage.py b/loader/lib/storage.py
index ab25793..1a34b1b 100644
--- a/loader/lib/storage.py
+++ b/loader/lib/storage.py
@@ -131,7 +131,7 @@ class ArchivesParserStorage(ArchivesParser):
if len(curs.fetchall()):
log.status("Tagged thread %s with listid %s" % (self.threadid, listid))
- curs.execute("INSERT INTO messages (parentid, threadid, _from, _to, cc, subject, date, has_attachment, messageid, bodytxt) VALUES (%(parentid)s, %(threadid)s, %(from)s, %(to)s, %(cc)s, %(subject)s, %(date)s, %(has_attachment)s, %(messageid)s, %(bodytxt)s) RETURNING id", {
+ curs.execute("INSERT INTO messages (parentid, threadid, _from, _to, cc, subject, date, has_attachment, messageid, bodytxt, rawtxt) VALUES (%(parentid)s, %(threadid)s, %(from)s, %(to)s, %(cc)s, %(subject)s, %(date)s, %(has_attachment)s, %(messageid)s, %(bodytxt)s, %(rawtxt)s) RETURNING id", {
'parentid': self.parentid,
'threadid': self.threadid,
'from': self._from,
@@ -142,6 +142,7 @@ class ArchivesParserStorage(ArchivesParser):
'has_attachment': len(self.attachments) > 0,
'messageid': self.msgid,
'bodytxt': self.bodytxt,
+ 'rawtxt': self.rawtxt,
})
id = curs.fetchall()[0][0]
if len(self.attachments):
diff --git a/loader/sql/schema.sql b/loader/sql/schema.sql
index ff8e5d3..b6cf49f 100644
--- a/loader/sql/schema.sql
+++ b/loader/sql/schema.sql
@@ -11,7 +11,8 @@ CREATE TABLE messages (
date timestamptz NOT NULL,
has_attachment boolean NOT NULL,
messageid text NOT NULL,
- bodytxt text NOT NULL
+ bodytxt text NOT NULL,
+ rawtxt text NOT NULL
);
CREATE INDEX idx_messages_threadid ON messages(threadid);
CREATE UNIQUE INDEX idx_messages_msgid ON messages(messageid);