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 2018/10/10 09:35:37 UTC
[incubator-ponymail] branch master updated: Revert "Bug: no need to
sort after scroll"
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 4742e8b Revert "Bug: no need to sort after scroll"
4742e8b is described below
commit 4742e8b980d89cfd8387d00808fb02a9f308b393
Author: Sebb <se...@apache.org>
AuthorDate: Wed Oct 10 10:34:20 2018 +0100
Revert "Bug: no need to sort after scroll"
This reverts commit 557920c07620c786fa18d026e58396325f40c965.
---
CHANGELOG.md | 1 -
site/api/pminfo.lua | 2 ++
site/api/stats.lua | 2 ++
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 02860be..040af22 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,5 @@
## Changes in 0.11-SNAPSHOT
- Bug: cannot download more than 10K mails to a mbox file (#475)
-- Bug: no need to sort after scroll (#477)
- Enh: Ensure non-printable chars are not lost in source and mbox output (#476)
- Enh: display buttons even if no mails are found in a month (#470)
- Bug: Javascript URLs must always use URL_BASE (#469)
diff --git a/site/api/pminfo.lua b/site/api/pminfo.lua
index 56f8d48..961beaf 100644
--- a/site/api/pminfo.lua
+++ b/site/api/pminfo.lua
@@ -142,6 +142,8 @@ function handle(r)
doc, sid = elastic.scroll(sid)
end
elastic.clear_scroll(sid) -- we're done with the sid, release it
+ -- scroll always sorts by _doc so we need to fix that
+ table.sort (hits, function (k1, k2) return k1._source.epoch > k2._source.epoch end )
else
local doc = elastic.raw(squery)
hits = doc.hits.hits
diff --git a/site/api/stats.lua b/site/api/stats.lua
index bdb28f5..a958228 100644
--- a/site/api/stats.lua
+++ b/site/api/stats.lua
@@ -560,6 +560,8 @@ function handle(r)
js, sid = elastic.scroll(sid)
end
elastic.clear_scroll(sid) -- we're done with the sid, release it
+ -- ES scroll uses _doc order for efficiency; we need to sort here
+ table.sort (dhh, function (k1, k2) return k1._source.epoch > k2._source.epoch end )
-- otherwise, we can just do a standard raw query
else
local doc = elastic.raw(squery)