We should not need to use QueryParser for internal queries,
but rather for external ones.
We'll also be exposing searching Message-IDs with the "mid:" prefix
for broken mids on some servers, and enabling partial searching
with 'm' to help with URL truncations.
Since thread IDs may be volatile, they cannot be exposed to the
public, there's no reason to expose them to the query parser,
either.
Also, add 's:' as an alternative probabilistic prefix to 'subject'
as it is shorter.
# setup prefixes
my %bool_pfx_internal = (
type => 'T', # "mail" or "ghost"
# setup prefixes
my %bool_pfx_internal = (
type => 'T', # "mail" or "ghost"
- mid => 'Q', # uniQue id (Message-ID)
+ thread => 'G', # newsGroup (or similar entity - e.g. a web forum name)
);
my %bool_pfx_external = (
path => 'XPATH',
);
my %bool_pfx_external = (
path => 'XPATH',
- thread => 'G', # newsGroup (or similar entity - e.g. a web forum name)
+ mid => 'Q', # uniQue id (Message-ID)
);
my %prob_prefix = (
subject => 'S',
);
my %prob_prefix = (
subject => 'S',
+ s => 'S', # for mairix compatibility
+ m => 'Q', # 'mid' is exact, 'm' can do partial
);
my %all_pfx = (%bool_pfx_internal, %bool_pfx_external, %prob_prefix);
);
my %all_pfx = (%bool_pfx_internal, %bool_pfx_external, %prob_prefix);
sub get_subject_path {
my ($self, $path, $opts) = @_;
sub get_subject_path {
my ($self, $path, $opts) = @_;
- my $query = $self->qp->parse_query("path:".mid_compress($path), 0);
- $self->do_enquire($query, $opts);
+ my $q = Search::Xapian::Query->new(xpfx("path").mid_compress($path));
+ $self->do_enquire($q, $opts);
my $smsg = eval { $self->lookup_message($mid) };
return { total => 0, msgs => [] } unless $smsg;
my $smsg = eval { $self->lookup_message($mid) };
return { total => 0, msgs => [] } unless $smsg;
- my $qp = $self->qp;
- my $qtid = $qp->parse_query('thread:'.$smsg->thread_id, 0);
- my $qsub = $qp->parse_query('path:'.mid_compress($smsg->path), 0);
+ my $qtid = Search::Xapian::Query->new(xpfx('thread').$smsg->thread_id);
+ my $path = mid_compress($smsg->path);
+ my $qsub = Search::Xapian::Query->new(xpfx('path').$path);
my $query = Search::Xapian::Query->new(OP_OR, $qtid, $qsub);
$self->do_enquire($query, $opts);
}
my $query = Search::Xapian::Query->new(OP_OR, $qtid, $qsub);
$self->do_enquire($query, $opts);
}