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/05/05 13:45:47 UTC

[incubator-ponymail-foal] branch master updated: Increase the number of lists returned during term aggregation

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 ea0e47b  Increase the number of lists returned during term aggregation
     new 5922466  Merge pull request #16 from sbp/aggregation-fix
ea0e47b is described below

commit ea0e47b530759e59d0d8068f02980584af136f31
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Wed May 5 13:14:12 2021 +0100

    Increase the number of lists returned during term aggregation
---
 server/plugins/background.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/server/plugins/background.py b/server/plugins/background.py
index 1d8c777..f70e411 100644
--- a/server/plugins/background.py
+++ b/server/plugins/background.py
@@ -40,12 +40,13 @@ async def get_lists(database: plugins.configuration.DBConfig) -> dict:
     """
     lists = {}
     db = plugins.database.Database(database)
+    limit = 8192
 
     # Fetch aggregations of all public emails
-    s = Search(using=db.client, index=database.db_prefix + "-mbox").query(
-        "match", private=False
+    s = Search(using=db.client, index=database.db_prefix + "-mbox").filter(
+        "term", private=False
     )
-    s.aggs.bucket("per_list", "terms", field="list_raw")
+    s.aggs.bucket("per_list", "terms", field="list_raw", size=limit)
 
     res = await db.search(
         index=database.db_prefix + "-mbox", body=s.to_dict(), size=0
@@ -59,10 +60,10 @@ async def get_lists(database: plugins.configuration.DBConfig) -> dict:
         }
 
     # Ditto, for private emails
-    s = Search(using=db.client, index=database.db_prefix + "-mbox").query(
-        "match", private=True
+    s = Search(using=db.client, index=database.db_prefix + "-mbox").filter(
+        "term", private=True
     )
-    s.aggs.bucket("per_list", "terms", field="list_raw")
+    s.aggs.bucket("per_list", "terms", field="list_raw", size=limit)
 
     res = await db.search(
         index=database.db_prefix + "-mbox", body=s.to_dict(), size=0