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/10/17 15:43:46 UTC
[incubator-ponymail-foal] 02/02: add in shortening of body in
migrator
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 d779c25fcd3ea2d927608fe553999c3be09cdb59
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Oct 17 17:43:26 2021 +0200
add in shortening of body in migrator
---
tools/migrate.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/migrate.py b/tools/migrate.py
index ab19fa8..e288330 100644
--- a/tools/migrate.py
+++ b/tools/migrate.py
@@ -198,6 +198,9 @@ def process_document(old_es, doc, old_dbname, dbname_source, dbname_mbox, do_dki
source["_source"]["permalinks"] = doc["_source"]["permalinks"]
doc["_source"]["dbid"] = hashlib.sha3_256(source_text).hexdigest()
+ # Add in shortened body for search aggs
+ doc["_source"]["body_short"] = doc["_source"]["body"][:210]
+
# Add in gravatar
header_from = doc["_source"]["from"]
mailaddr = email.utils.parseaddr(header_from)[1]
Re: [incubator-ponymail-foal] 02/02: add in shortening of body in migrator
Posted by sebb <se...@gmail.com>.
On Sun, 17 Oct 2021 at 16:43, <hu...@apache.org> wrote:
>
> 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 d779c25fcd3ea2d927608fe553999c3be09cdb59
> Author: Daniel Gruno <hu...@apache.org>
> AuthorDate: Sun Oct 17 17:43:26 2021 +0200
>
> add in shortening of body in migrator
> ---
> tools/migrate.py | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/migrate.py b/tools/migrate.py
> index ab19fa8..e288330 100644
> --- a/tools/migrate.py
> +++ b/tools/migrate.py
> @@ -198,6 +198,9 @@ def process_document(old_es, doc, old_dbname, dbname_source, dbname_mbox, do_dki
> source["_source"]["permalinks"] = doc["_source"]["permalinks"]
> doc["_source"]["dbid"] = hashlib.sha3_256(source_text).hexdigest()
>
> + # Add in shortened body for search aggs
> + doc["_source"]["body_short"] = doc["_source"]["body"][:210]
-1
Don't use magic numbers in code.
Replace with documented constant or configuration item.
> +
> # Add in gravatar
> header_from = doc["_source"]["from"]
> mailaddr = email.utils.parseaddr(header_from)[1]