This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git
The following commit(s) were added to refs/heads/master by this push: new 2e16918 option to reduce stats.lua output 2e16918 is described below commit 2e16918bd445f552383bbc163d2a27dd758b6277 Author: Sebb <s...@apache.org> AuthorDate: Sat Feb 24 00:44:30 2018 +0000 option to reduce stats.lua output This fixes #438 --- CHANGELOG.md | 1 + docs/API.md | 7 ++++++- site/api/stats.lua | 11 +++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89646e7..c18abbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Bug: Indentation in mail content (leading white-space) not shown (#432) - Bug: does not make sense to allow empty domain name in LID (#434) - Bug: Inconsistent LID validation (#356) +- Enh: option to reduce stats.lua output (#438) ## CHANGES in 0.10: - Bug: Use correct dependency order to fix OAuth login problem (#431) diff --git a/docs/API.md b/docs/API.md index 909681f..e8eba8f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -41,7 +41,7 @@ Note: date and epoch are in UTC ### Fetching list data Usage: -`GET /api/stats.lua?list=$list&domain=$domain[&d=$timespan][&q=$query][&header_from=$from][&header_to=$to][&header_subject=$subject][&header_body=$body][&quick][&s=$s&e=$e]` +`GET /api/stats.lua?list=$list&domain=$domain[&d=$timespan][&q=$query][&header_from=$from][&header_to=$to][&header_subject=$subject][&header_body=$body][&quick][&emailsOnly][&s=$s&e=$e]` Parameters: @@ -58,6 +58,11 @@ Parameters: - $to: Optional To: address - $subject: Optional Subject: line - $body: Optional body text + +Options: + + - quick: only return list of email epochs + - emailsOnly: only return list of emails; omit thread structure, top 10 participants and word-cloud Response example: diff --git a/site/api/stats.lua b/site/api/stats.lua index b9c913f..e55a4f2 100644 --- a/site/api/stats.lua +++ b/site/api/stats.lua @@ -76,6 +76,9 @@ function handle(r) r:puts("{}") return cross.OK end + -- emailsOnly: return email summaries only, not derived data: + -- i.e. omit thread_struct, top 10 participants and word-cloud + local emailsOnly = get.emailsOnly local qs = "*" -- positive query local nqs = "" -- negative query local dd = "lte=1M" @@ -326,7 +329,7 @@ function handle(r) end local cloud = nil - if config.wordcloud and not statsOnly then + if config.wordcloud and not statsOnly and not emailsOnly then cloud = {} -- Word cloud! local doc = elastic.raw { @@ -585,7 +588,7 @@ function handle(r) local name = extractCanonName(email.from) local eid = ("%s <%s>"):format(name, eml) - if not statsOnly then + if not statsOnly and not emailsOnly then senders[eid] = senders[eid] or { email = eml, gravatar = gravatar, @@ -681,7 +684,7 @@ function handle(r) local allparts = 0 -- number of participants local top10 = {} - if not statsOnly then + if not statsOnly and not emailsOnly then local stable = {} for k, v in pairs(senders) do table.insert(stable, v) @@ -724,7 +727,7 @@ function handle(r) listdata.max = maxresults listdata.using_wc = wc listdata.no_threads = #threads - if not statsOnly then + if not statsOnly and not emailsOnly then listdata.thread_struct = threads end listdata.firstYear = datespan.firstYear -- To stop receiving notification emails like this one, please contact s...@apache.org.