]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Search.pm
Merge branch 'thread-view-skel'
[public-inbox.git] / lib / PublicInbox / Search.pm
index 8c0bab185d489008356e8efeafa641893549eac7..3a908ac6caba8124a8c7ce4071ee3692e4cb063b 100644 (file)
@@ -36,7 +36,8 @@ use constant {
        # 8 - remove redundant/unneeded document data
        # 9 - disable Message-ID compression (SHA-1)
        # 10 - optimize doc for NNTP overviews
-       SCHEMA_VERSION => 10,
+       # 11 - merge threads when vivifying ghosts
+       SCHEMA_VERSION => 11,
 
        # n.b. FLAG_PURE_NOT is expensive not suitable for a public website
        # as it could become a denial-of-service vector
@@ -106,12 +107,15 @@ sub get_thread {
 
        return { total => 0, msgs => [] } unless $smsg;
        my $qtid = Search::Xapian::Query->new(xpfx('thread').$smsg->thread_id);
-       my $path = id_compress($smsg->path);
-       my $qsub = Search::Xapian::Query->new(xpfx('path').$path);
-       my $query = Search::Xapian::Query->new(OP_OR, $qtid, $qsub);
+       my $path = $smsg->path;
+       if (defined $path && $path ne '') {
+               my $path = id_compress($smsg->path);
+               my $qsub = Search::Xapian::Query->new(xpfx('path').$path);
+               $qtid = Search::Xapian::Query->new(OP_OR, $qtid, $qsub);
+       }
        $opts ||= {};
        $opts->{limit} ||= 1000;
-       _do_enquire($self, $query, $opts);
+       _do_enquire($self, $qtid, $opts);
 }
 
 sub _do_enquire {