From 71d0581a309ca83cf3be538141435111db8ed290 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 10 Dec 2016 01:09:51 +0000 Subject: search: always sort thread results in ascending time order This makes life easier for the threading algorithm, as we can use the implied ordering of timestamps to avoid temporary ghosts and resulting container vivication. This would've also allowed us to hide the bug (in most cases) fixed by the patch titled "thread: last Reference always wins", in case that needs to be reverted due to infinite looping. --- lib/PublicInbox/Search.pm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/PublicInbox/Search.pm') diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 8da30c19..5e6bfc68 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -158,6 +158,11 @@ sub get_thread { } $opts ||= {}; $opts->{limit} ||= 1000; + + # always sort threads by timestamp, this makes life easier + # for the threading algorithm (in SearchThread.pm) + $opts->{asc} = 1; + _do_enquire($self, $qtid, $opts); } -- cgit v1.2.3-24-ge0c7