$qry = $PublicInbox::Search::X{Query}->new(
PublicInbox::Search::OP_FILTER(),
$qry, 'T'.'c');
- $self->do_enquire($qry, $opt, CT);
+ $opt->{sort_col} = CT;
+ $self->do_enquire($qry, $opt);
}
sub roots2paths { # for diagnostics
$qp;
}
-sub misc_enquire_once { # retry_reopen callback
- my ($self, $qr, $opt) = @_;
- my $eq = $PublicInbox::Search::X{Enquire}->new($self->{xdb});
- $eq->set_query($qr);
- my $desc = !$opt->{asc};
- my $rel = $opt->{relevance} // 0;
- if ($rel == -1) { # ORDER BY docid
- $eq->set_docid_order($PublicInbox::Search::ENQ_ASCENDING);
- $eq->set_weighting_scheme($PublicInbox::Search::X{BoolWeight}->new);
- } elsif ($rel) {
- $eq->set_sort_by_relevance_then_value($MODIFIED, $desc);
- } else {
- $eq->set_sort_by_value_then_relevance($MODIFIED, $desc);
- }
- $eq->get_mset($opt->{offset} || 0, $opt->{limit} || 200);
-}
-
sub mset {
my ($self, $qs, $opt) = @_;
$opt ||= {};
$qs = 'type:inbox' if $qs eq '';
my $qr = $qp->parse_query($qs, $PublicInbox::Search::QP_FLAGS);
$opt->{relevance} = 1 unless exists $opt->{relevance};
- retry_reopen($self, \&misc_enquire_once, $qr, $opt);
+ $opt->{sort_col} = $MODIFIED;
+ $opt->{limit} ||= 200;
+ PublicInbox::Search::do_enquire($self, $qr, $opt);
}
sub ibx_data_once {
$qry = $X{Query}->new(OP_FILTER(), $qry,
$X{Query}->new(OP_VALUE_RANGE(), THREADID, $tid, $tid));
}
- do_enquire($self, $qry, $opt, TS);
+ $opt->{sort_col} //= TS;
+ do_enquire($self, $qry, $opt);
}
my %QPMETHOD_2_SYM = (add_prefix => ':', add_boolean_prefix => '=');
}
}
-sub do_enquire { # shared with CodeSearch
- my ($self, $qry, $opt, $col) = @_;
+sub do_enquire { # shared with CodeSearch and MiscSearch
+ my ($self, $qry, $opt) = @_;
my $enq = $X{Enquire}->new(xdb($self));
$enq->set_query($qry);
+ my $col = $opt->{sort_col} // TS;
my $rel = $opt->{relevance} // 0;
if ($rel == -2) { # ORDER BY docid/UID (highest first)
$enq->set_weighting_scheme($X{BoolWeight}->new);