You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2016/12/11 00:50:53 UTC

incubator-ponymail git commit: pminfo.lua creates top100 sender information but it's not used

Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 9bc73b31a -> 0cb3f31a4


pminfo.lua creates top100 sender information but it's not used

This fixes #282

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/0cb3f31a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/0cb3f31a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/0cb3f31a

Branch: refs/heads/master
Commit: 0cb3f31a4db1a82bc5ef586a85ee8767883b9358
Parents: 9bc73b3
Author: Sebb <se...@apache.org>
Authored: Sun Dec 11 00:50:37 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Sun Dec 11 00:50:37 2016 +0000

----------------------------------------------------------------------
 CHANGELOG.md        |  1 +
 site/api/pminfo.lua | 77 ++++++++++++++++++++++++++----------------------
 2 files changed, 42 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/0cb3f31a/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index efc4f9d..21c175a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -52,6 +52,7 @@
 - get by message-id does not work (#88)
 - stored date uses locale-dependent conversion and is ambiguous (#86)
 - search strings not properly quoted. (#76)
+- pminfo.lua creates top100 sender information but it's not used (#282)
 
 ## CHANGES in 0.9b:
 

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/0cb3f31a/site/api/pminfo.lua
----------------------------------------------------------------------
diff --git a/site/api/pminfo.lua b/site/api/pminfo.lua
index 6ef3a93..30c1fc3 100644
--- a/site/api/pminfo.lua
+++ b/site/api/pminfo.lua
@@ -80,10 +80,15 @@ function handle(r)
         size = 0, -- we don't need the hits themselves
         query = QUERY,
         aggs = {
-            lists = { -- active lists (needed?)
-                terms = {
-                    field = "list_raw",
-                    size = MAXRESULTS
+--            lists = { -- active lists (needed?)
+--                terms = {
+--                    field = "list_raw",
+--                    size = MAXRESULTS
+--                }
+--            },
+            nlists = { -- total active lists
+                cardinality = {
+                    field = "list_raw"
                 }
             },
             cards = { -- total participants
@@ -96,26 +101,26 @@ function handle(r)
                     field = "date",
                     interval = "1d"
                 }
-            },
-            top100 = { -- top100 senders (needed?)
-                terms = {
-                    field = "from_raw",
-                    size = 100
-                }
+--            },
+--            top100 = { -- top100 senders (needed?)
+--                terms = {
+--                    field = "from_raw",
+--                    size = 100
+--                }
             }
         }
     }
-    local lists = {} -- TODO unused?
-    local nal = 0 -- This *is* used
+--    local lists = {} -- TODO unused?
+    local nal = doc.aggregations.nlists.value -- This *is* used
 
-    for x,y in pairs (doc.aggregations.lists.buckets) do
-        local list, domain = y.key:match("^<?(.-)%.(.-)>?$")
-        if not domain:match("%..-%..-%..-") and domain:match("^[-_a-z0-9.]+$") and list:match("^[-_a-z0-9.]+$") then
-            lists[domain] = lists[domain] or {}
-            lists[domain][list] = y.doc_count
-            nal = nal + 1
-        end
-    end
+--    for x,y in pairs (doc.aggregations.lists.buckets) do
+--        local list, domain = y.key:match("^<?(.-)%.(.-)>?$")
+--        if not domain:match("%..-%..-%..-") and domain:match("^[-_a-z0-9.]+$") and list:match("^[-_a-z0-9.]+$") then
+--            lists[domain] = lists[domain] or {}
+--            lists[domain][list] = y.doc_count
+--            nal = nal + 1
+--        end
+--    end
     
     -- Debug time point 2
     
@@ -130,7 +135,7 @@ function handle(r)
         table.insert(activity, {v.key, v.doc_count})
     end
     
-    local active_senders = {} -- TODO unused?
+--    local active_senders = {} -- TODO unused?
     
     
     
@@ -138,19 +143,19 @@ function handle(r)
     table.insert(t, r:clock() - tnow)
     tnow = r:clock()
     
-    for x,y in pairs (doc.aggregations.top100.buckets) do
-        local eml = y.key:match("<(.-)>") or y.key:match("%S+@%S+") or "unknown"
-        local gravatar = r:md5(eml)
-        local name = y.key:match("([^<]+)%s*<.->") or y.key:match("%S+@%S+") or eml
-        name = name:gsub("\"", "")
-        table.insert(active_senders, {
-            id = y.key,
-            email = eml,
-            gravatar = gravatar,
-            name = name,
-            count = y.doc_count
-        })
-    end
+--    for x,y in pairs (doc.aggregations.top100.buckets) do
+--        local eml = y.key:match("<(.-)>") or y.key:match("%S+@%S+") or "unknown"
+--        local gravatar = r:md5(eml)
+--        local name = y.key:match("([^<]+)%s*<.->") or y.key:match("%S+@%S+") or eml
+--        name = name:gsub("\"", "")
+--        table.insert(active_senders, {
+--            id = y.key,
+--            email = eml,
+--            gravatar = gravatar,
+--            name = name,
+--            count = y.doc_count
+--        })
+--    end
 
     
     -- Debug time point 4
@@ -267,9 +272,9 @@ function handle(r)
     listdata.no_threads = #threads
     listdata.hits = h
     listdata.participants = no_senders
-    listdata.top100 = active_senders -- TODO unused by callers?
+--    listdata.top100 = active_senders -- TODO unused by callers?
     listdata.no_active_lists = nal
-    listdata.active_lists = lists -- TODO unused by callers?
+--    listdata.active_lists = lists -- TODO unused by callers?
     listdata.took = r:clock() - now
     listdata.activity = activity