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 2017/01/06 11:46:22 UTC

incubator-ponymail git commit: pminfo.lua - scroll/scan ignores sort order

Repository: incubator-ponymail
Updated Branches:
  refs/heads/master b9db11ffc -> 216dfac83


pminfo.lua - scroll/scan ignores sort order

This fixes #322

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

Branch: refs/heads/master
Commit: 216dfac833fbc91f7aa4c7c6d353f01bc55a3fe3
Parents: b9db11f
Author: Sebb <se...@apache.org>
Authored: Fri Jan 6 11:44:52 2017 +0000
Committer: Sebb <se...@apache.org>
Committed: Fri Jan 6 11:44:52 2017 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/216dfac8/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e3d1cf..8d5343f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -103,6 +103,7 @@
 - domain parameter is not used externally (#319)
 - pminfo.lua fetches and saves epoch but never uses it #320
 - pminfo.lua - no need to use scroll unless doc count > 10000 (#321)
+- pminfo.lua - scroll/scan ignores sort order (#322)
 
 ## CHANGES in 0.9b:
 

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/216dfac8/site/api/pminfo.lua
----------------------------------------------------------------------
diff --git a/site/api/pminfo.lua b/site/api/pminfo.lua
index 9f8fb7a..6f9cf25 100644
--- a/site/api/pminfo.lua
+++ b/site/api/pminfo.lua
@@ -116,11 +116,11 @@ function handle(r)
     local num_threads = 0
     local emails = {}
     local squery = {
-        _source = {'message-id','in-reply-to','subject','references'},
+        _source = {'message-id','in-reply-to','subject','references','epoch'},
         query = QUERY,
         sort = {
             {
-                date = {
+                epoch = {
                     order = "desc"
                 }
             }
@@ -140,6 +140,8 @@ function handle(r)
                 doc, sid = elastic.scroll(sid)
             end
         end
+        -- scroll/scan ignores the sort order!
+        table.sort (hits, function (k1, k2) return k1._source.epoch > k2._source.epoch end )
     else
         local doc = elastic.raw(squery)
         hits = doc.hits.hits