From 36f62781880dd38b94011f0d351fcf7b0aa2916c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 21 Jun 2016 10:35:36 +0000 Subject: search: support Subject:-less messages Some mailing lists allow empty Subject headers and we shall support searching and indexing them. --- lib/PublicInbox/Search.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index bf50365a..3a908ac6 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -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 { -- cgit v1.2.3-24-ge0c7