-# Copyright (C) 2015 all contributors <meta@public-inbox.org>
-# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
+# Copyright (C) 2015-2018 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# based on notmuch, but with no concept of folders, files or flags
#
# Read-only search interface for use by the web and NNTP interfaces
q => 'XQUOT',
nq => 'XNQ',
+ dfn => 'XDFN',
+ dfa => 'XDFA',
+ dfb => 'XDFB',
+ dfhh => 'XDFHH',
+ dfctx => 'XDFCTX',
+ dfpre => 'XDFPRE',
+ dfpost => 'XDFPOST',
+ dfblob => 'XDFPRE XDFPOST',
# default:
'' => 'XMID S A XNQ XQUOT XFN',
'a:' => 'match within the To, Cc, and From headers',
'tc:' => 'match within the To and Cc headers',
'bs:' => 'match within the Subject and body',
+ 'dfn:' => 'match filename from diff',
+ 'dfa:' => 'match diff removed (-) lines',
+ 'dfb:' => 'match diff added (+) lines',
+ 'dfhh:' => 'match diff hunk header context (usually a function name)',
+ 'dfctx:' => 'match diff context lines',
+ 'dfpre:' => 'match pre-image git blob ID',
+ 'dfpost:' => 'match post-image git blob ID',
+ 'dfblob:' => 'match either pre or post-image git blob ID',
);
chomp @HELP;
-# TODO:
-# df (filenames from diff)
-# da (diff a/ removed lines)
-# db (diff b/ added lines)
my $mail_query = Search::Xapian::Query->new('T' . 'mail');
_do_enquire($self, $query, {num => 1, limit => 200, offset => $offset});
}
+sub query_ts {
+ my ($self, $ts, $opts) = @_;
+ my $qp = $self->{qp_ts} ||= eval {
+ my $q = Search::Xapian::QueryParser->new;
+ $q->set_database($self->{xdb});
+ $q->add_valuerangeprocessor(
+ Search::Xapian::NumberValueRangeProcessor->new(TS));
+ $q
+ };
+ my $query = $qp->parse_query($ts, QP_FLAGS);
+ _do_enquire($self, $query, $opts);
+}
+
sub lookup_message {
my ($self, $mid) = @_;
$mid = mid_clean($mid);
my ($self, $mid) = @_;
retry_reopen($self, sub {
my $smsg = lookup_message($self, $mid) or return;
- PublicInbox::SearchMsg->load_doc($smsg->{doc});
+ $smsg->load_expand;
});
}