* [PATCH 7/7] search: always sort thread results in ascending time order
2016-12-10 3:42 5% [PATCH 0/7] message threading fixes for WWW UI Eric Wong
@ 2016-12-10 3:43 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-12-10 3:43 UTC (permalink / raw)
To: meta
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/Mbox.pm | 2 +-
lib/PublicInbox/Search.pm | 5 +++++
lib/PublicInbox/View.pm | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm
index fd623f6..2565ea5 100644
--- a/lib/PublicInbox/Mbox.pm
+++ b/lib/PublicInbox/Mbox.pm
@@ -115,7 +115,7 @@ sub new {
cb => $cb,
ctx => $ctx,
msgs => [],
- opts => { asc => 1, offset => 0 },
+ opts => { offset => 0 },
}, $class;
}
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 8da30c1..5e6bfc6 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);
}
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index c2e1ae7..ec5f7e0 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -327,7 +327,7 @@ sub stream_thread ($$) {
sub thread_html {
my ($ctx) = @_;
my $mid = $ctx->{mid};
- my $sres = $ctx->{srch}->get_thread($mid, { asc => 1 });
+ my $sres = $ctx->{srch}->get_thread($mid);
my $msgs = load_results($sres);
my $nr = $sres->{total};
return missing_thread($ctx) if $nr == 0;
--
EW
^ permalink raw reply related [relevance 7%]
* [PATCH 0/7] message threading fixes for WWW UI
@ 2016-12-10 3:42 5% Eric Wong
2016-12-10 3:43 7% ` [PATCH 7/7] search: always sort thread results in ascending time order Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-12-10 3:42 UTC (permalink / raw)
To: meta
This series improves thread handling in several oddball
cases.
In the Xapian search indexing phase, the In-Reply-To header
is always considered the last (direct) parent of a message.
This is necessary in cases where a MUA specifies References
in an invalid order. This is also what our View.pm display
has done for generating "reply" links.
Not many repos are affected by this, but
"public-inbox-index --reindex" will make those consistent
(there is no incompatible Xapian DB version bump).
We will now prune ghosts without children before display, as
they are sometimes the result of buggy (or malicious) MUAs
inserting spaces or otherwise mangling References: headers.
Ghosts with valid children remain shown, as they are likely to
be legitimate (but lost) messages.
Deploying over the next few hours, .onions first!
Currently reindexing git@vger mirror:
http://czquwvybam4bgbro.onion/meta
Up next:
http://hjrcffqmbrq6wope.onion/meta
Last: (also public-inbox.org)
http://ou63pmih66umazou.onion/meta
Eric Wong (7):
search: favor In-Reply-To over last References iff IRT exists
view: favor SearchMsg for In-Reply-To over Email::MIME
thread: fix comment describing its existence
view: reduce indentation for skeleton generation
view: skip ghosts with no direct children
thread: last Reference always wins
search: always sort thread results in ascending time order
lib/PublicInbox/Mbox.pm | 2 +-
lib/PublicInbox/Search.pm | 5 ++++
lib/PublicInbox/SearchIdx.pm | 22 ++++++++++++---
lib/PublicInbox/SearchThread.pm | 30 ++++++++++++++------
lib/PublicInbox/View.pm | 61 +++++++++++++++++++++--------------------
t/thread-cycle.t | 8 ------
6 files changed, 76 insertions(+), 52 deletions(-)
--
EW
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-12-10 3:42 5% [PATCH 0/7] message threading fixes for WWW UI Eric Wong
2016-12-10 3:43 7% ` [PATCH 7/7] search: always sort thread results in ascending time order Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).