]> Sergey Matveev's repositories - public-inbox.git/commitdiff
search: support Subject:-less messages
authorEric Wong <e@80x24.org>
Tue, 21 Jun 2016 10:35:36 +0000 (10:35 +0000)
committerEric Wong <e@80x24.org>
Tue, 21 Jun 2016 10:36:23 +0000 (10:36 +0000)
Some mailing lists allow empty Subject headers and we shall support
searching and indexing them.

lib/PublicInbox/Search.pm

index bf50365a04603d86d9722a923e4a36f0b8287c77..3a908ac6caba8124a8c7ce4071ee3692e4cb063b 100644 (file)
@@ -107,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 {