about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-03 20:18:34 +0000
committerEric Wong <e@80x24.org>2018-04-03 10:08:57 +0000
commit4f0b09919ae9c8823bf6c1fa1452bc27945952a3 (patch)
treedb348774ae2d12148eb7d161dce910481eea31dc /lib
parent3f3d9cf7d88a851721f1f8468e1311a4f0c02ff6 (diff)
downloadpublic-inbox-4f0b09919ae9c8823bf6c1fa1452bc27945952a3.tar.gz
I guess nobody uses this command (slrnpull does not), and
the breakage was not noticed until I started writing new
tests for multi-MID handling.

Fixes: 3fc411c772a21d8f ("search: drop pointless range processors for Unix timestamp")
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/NNTP.pm2
-rw-r--r--lib/PublicInbox/Search.pm13
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 267fe4b9..23be7754 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -336,7 +336,7 @@ sub cmd_newnews ($$$$;$$) {
         long_response($self, 0, long_response_limit, sub {
                 my ($i) = @_;
                 my $srch = $srch[0];
-                my $res = $srch->query($ts, $opts);
+                my $res = $srch->query_ts($ts, $opts);
                 my $msgs = $res->{msgs};
                 if (my $nr = scalar @$msgs) {
                         more($self, '<' .
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 9ab5afe6..df02e0b5 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -281,6 +281,19 @@ sub query_xover {
         _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);