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 16:10:13 UTC
[incubator-ponymail-foal] branch master updated: exclude body,
use shortened body only, for stats
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 5e85a1e exclude body, use shortened body only, for stats
5e85a1e is described below
commit 5e85a1e5d282b2b9636b2a1af1fa1a1f59343700
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Oct 17 18:10:01 2021 +0200
exclude body, use shortened body only, for stats
---
server/plugins/messages.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/server/plugins/messages.py b/server/plugins/messages.py
index b705962..bab3afa 100644
--- a/server/plugins/messages.py
+++ b/server/plugins/messages.py
@@ -335,6 +335,8 @@ async def query(
}
if metadata_only: # Only doc IDs and AAA fields.
es_query["_source"] = ["deleted", "private", "mid", "dbid", "list_raw"]
+ else:
+ es_query["_source"] = { "exclude": ["body"] }
async for hit in session.database.scan(
query=es_query,
preserve_order=preserve_order
@@ -350,8 +352,11 @@ async def query(
doc["gravatar"] = gravatar(doc)
if not session.credentials:
doc = anonymize(doc)
- if shorten and len(doc["body"] or "") > BODY_MAXLEN:
- doc["body"] = doc["body"][:BODY_MAXLEN] + '...'
+ if shorten and len(doc["body_short"] or "") > BODY_MAXLEN:
+ doc["body"] = doc["body_short"][:BODY_MAXLEN] + '...'
+ else:
+ doc["body"] = doc["body_short"]
+ del doc["body_short"]
trim_email(doc)
docs.append(doc)
hits += 1