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/15 16:23:35 UTC
[incubator-ponymail-foal] branch master updated: if epoch_order is
specifically given as ascending, set preserve_order for ES scan
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 99b9822 if epoch_order is specifically given as ascending, set preserve_order for ES scan
99b9822 is described below
commit 99b9822aaf1cdbc81ab59c6f705e8c6d2f32b5c1
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Sep 15 11:23:12 2021 -0500
if epoch_order is specifically given as ascending, set preserve_order for ES scan
---
server/plugins/messages.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/server/plugins/messages.py b/server/plugins/messages.py
index ba9031f..aa1d8b1 100644
--- a/server/plugins/messages.py
+++ b/server/plugins/messages.py
@@ -316,6 +316,7 @@ async def query(
docs = []
hits = 0
assert session.database, DATABASE_NOT_CONNECTED
+ preserve_order = True if epoch_order == "asc" else False
es_query = {
"query": {"bool": query_defuzzed},
"sort": [{"epoch": {"order": epoch_order}}],
@@ -323,7 +324,8 @@ async def query(
if metadata_only: # Only doc IDs and AAA fields.
es_query["_source"] = ["deleted", "private", "mid", "dbid", "list_raw"]
async for hit in session.database.scan(
- query=es_query
+ query=es_query,
+ preserve_order=preserve_order
):
doc = hit["_source"]
# If email was delete/hidden and we're not doing an admin query, ignore it