You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/09/12 14:38:12 UTC

[incubator-ponymail-foal] branch master updated: if reindexing with dkim, store using dkim ID

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


The following commit(s) were added to refs/heads/master by this push:
     new 95757f2  if reindexing with dkim, store using dkim ID
95757f2 is described below

commit 95757f2e38590a550470a741678b5bcc8b3d763d
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Sep 12 09:38:08 2021 -0500

    if reindexing with dkim, store using dkim ID
---
 tools/migrate.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/migrate.py b/tools/migrate.py
index b24711d..8d0a75a 100644
--- a/tools/migrate.py
+++ b/tools/migrate.py
@@ -185,9 +185,11 @@ def process_document(old_es, doc, old_dbname, dbname_source, dbname_mbox, do_dki
         source_text = base64.b64decode(source_text)
     else:  # bytify
         source_text = source_text.encode("utf-8", "ignore")
+    archive_as_id = doc["_id"]
     if do_dkim:
         dkim_id = generators.dkimid(None, None, list_id, None, source_text)
         old_id = doc["_id"]
+        archive_as_id = dkim_id
         doc["_source"]["mid"] = dkim_id
         doc["_source"]["permalinks"] = [dkim_id, old_id]
     else:
@@ -218,7 +220,7 @@ def process_document(old_es, doc, old_dbname, dbname_source, dbname_mbox, do_dki
 
     # Copy to new DB
     return (
-        {"index": dbname_mbox, "id": doc["_id"], "body": doc["_source"]},
+        {"index": dbname_mbox, "id": archive_as_id, "body": doc["_source"]},
         {"index": dbname_source, "id": doc["_source"]["dbid"], "body": source["_source"]},
     )