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/12/14 16:10:48 UTC

[incubator-ponymail-foal] branch master updated: Tweak word cloud scope

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 aeed79a  Tweak word cloud scope
aeed79a is described below

commit aeed79a9a394da06ff4dcc751e8d389f39f50f2f
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Dec 14 17:10:30 2021 +0100

    Tweak word cloud scope
---
 server/plugins/messages.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/server/plugins/messages.py b/server/plugins/messages.py
index b0c8d47..6d96671 100644
--- a/server/plugins/messages.py
+++ b/server/plugins/messages.py
@@ -441,10 +441,13 @@ async def wordcloud(session, query_defuzzed):
     """
     wc = {}
     try:
+        # Copy the query and ensure we're only looking at public content
+        wc_public_query = dict(query_defuzzed)
+        wc_public_query["filter"] = [{"term": {"private": False}}]
         res = await session.database.search(
             body={
                 "size": 0,
-                "query": {"bool": query_defuzzed},
+                "query": {"bool": wc_public_query},
                 "aggregations": {
                     "cloud": {"significant_terms": {"field": "subject", "size": 10}}
                 },