This is an automated email from the ASF dual-hosted git repository. humbedooh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 9a356488d8b6cceebbfb11a4994a09a9a09320a6 Author: Daniel Gruno <[email protected]> AuthorDate: Thu Sep 10 16:51:22 2020 +0200 rename notes to _notes, add an additional _archived_at field --- tools/archiver.py | 3 ++- tools/import-mbox.py | 4 ++-- tools/mappings.yaml | 4 +++- tools/migrate.py | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/archiver.py b/tools/archiver.py index 255866f..a6d236b 100755 --- a/tools/archiver.py +++ b/tools/archiver.py @@ -494,7 +494,8 @@ class Archiver(object): # N.B. Also used by import-mbox.py "body": body.unflow() if body else "", "html_source_only": body and body.html_as_source or False, "attachments": attachments, - "notes": notes, + "_notes": notes, + "_archived_at": int(time.time()), } return output_json, contents, msg_metadata, irt diff --git a/tools/import-mbox.py b/tools/import-mbox.py index 02ccf55..21ca9ba 100755 --- a/tools/import-mbox.py +++ b/tools/import-mbox.py @@ -311,8 +311,8 @@ class SlurpThread(Thread): ] # Mark that we imported this email - json["notes"] = [x for x in json["notes"] if "ARCHIVE:" not in x] # Pop archiver.py note - json["notes"].append(["IMPORT: Email imported as %s at %u" % (json["mid"], time.time())]) + json["_notes"] = [x for x in json["_notes"] if "ARCHIVE:" not in x] # Pop archiver.py note + json["_notes"].append(["IMPORT: Email imported as %s at %u" % (json["mid"], time.time())]) try: # temporary hack to try and find an encoding issue # needs to be replaced by proper exception handling diff --git a/tools/mappings.yaml b/tools/mappings.yaml index 8c881b7..f0fcfdf 100644 --- a/tools/mappings.yaml +++ b/tools/mappings.yaml @@ -87,8 +87,10 @@ mbox: type: text to: type: text - notes: + _notes: type: text + _archived_at: + type: long notification: properties: date: diff --git a/tools/migrate.py b/tools/migrate.py index 3968709..74c14f5 100644 --- a/tools/migrate.py +++ b/tools/migrate.py @@ -109,7 +109,7 @@ async def main(): doc['_source']['dbid'] = hashlib.sha3_256(source_text).hexdigest() # Append migration details to notes field in doc - notes = doc['_source'].get('notes', []) + notes = doc['_source'].get('_notes', []) # We want a list, not a single string if isinstance(notes, str): notes = list(notes) @@ -119,7 +119,7 @@ async def main(): if do_dkim: notes.append("REINDEX: Document re-indexed with DKIM_ID at %u, " "from %s to %s" % (now, dkim_id, old_id)) - doc['_source']['notes'] = notes + doc['_source']['_notes'] = notes # Copy to new DB bulk_array.append({
