X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FSearchMsg.pm;h=afba8b1a814c92c978c37c1ec3f44ea5b6a443e9;hb=3d41aa23f35501ca92aab8aa42980fa73f7fa74f;hp=5bb00778f1472712d1d609d72bda75125fea3ad0;hpb=492910d43c179a7e1919b2d0f417aea9473f9730;p=public-inbox.git
diff --git a/lib/PublicInbox/SearchMsg.pm b/lib/PublicInbox/SearchMsg.pm
index 5bb00778..afba8b1a 100644
--- a/lib/PublicInbox/SearchMsg.pm
+++ b/lib/PublicInbox/SearchMsg.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 all contributors
+# Copyright (C) 2015-2018 all contributors
# License: AGPL-3.0+
# based on notmuch, but with no concept of folders, files or flags
#
@@ -14,7 +14,7 @@ use PublicInbox::Address;
sub new {
my ($class, $mime) = @_;
my $doc = Search::Xapian::Document->new;
- $doc->add_term(PublicInbox::Search::xpfx('type') . 'mail');
+ $doc->add_term('T' . 'mail');
bless { type => 'mail', doc => $doc, mime => $mime }, $class;
}
@@ -29,6 +29,22 @@ sub get_val ($$) {
Search::Xapian::sortable_unserialise($doc->get_value($col));
}
+sub load_expand {
+ my ($self) = @_;
+ my $doc = $self->{doc};
+ my $data = $doc->get_data or return;
+ $self->{ts} = get_val($doc, &PublicInbox::Search::TS);
+ utf8::decode($data);
+ my ($subj, $from, $refs, $to, $cc, $blob) = split(/\n/, $data);
+ $self->{subject} = $subj;
+ $self->{from} = $from;
+ $self->{references} = $refs;
+ $self->{to} = $to;
+ $self->{cc} = $cc;
+ $self->{blob} = $blob;
+ $self;
+}
+
sub load_doc {
my ($class, $doc) = @_;
my $data = $doc->get_data or return;
@@ -155,6 +171,7 @@ sub thread_id {
$self->{thread} = _get_term_val($self, 'G', qr/\AG/); # *G*roup
}
+# XXX: consider removing this, we can phrase match subject
sub path {
my ($self) = @_;
my $path = $self->{path};