user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 23/34] nntp: fix NEWNEWS command
  @ 2018-03-06  8:42  5% ` Eric Wong (Contractor, The Linux Foundation)
  0 siblings, 0 replies; 3+ results
From: Eric Wong (Contractor, The Linux Foundation) @ 2018-03-06  8:42 UTC (permalink / raw)
  To: meta

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")
---
 lib/PublicInbox/NNTP.pm   |  2 +-
 lib/PublicInbox/Search.pm | 14 ++++++++++++++
 t/nntpd.t                 |  2 ++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 895e502..fb65ddc 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 802984b..4dc2747 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -330,6 +330,20 @@ sub query_xover {
 	_do_enquire($self, $query, $opts);
 }
 
+sub query_ts {
+	my ($self, $ts, $opts) = @_;
+	my $qp = $self->{qp_ts} ||= eval {
+		my $q = Search::Xapian::QueryParser->new;
+		$q->set_database($self->{skel} || $self->{xdb});
+		$q->add_valuerangeprocessor(
+			Search::Xapian::NumberValueRangeProcessor->new(TS));
+		$q
+	};
+	my $query = $qp->parse_query($ts, QP_FLAGS);
+	$opts->{enquire} = enquire_skel($self);
+	_do_enquire($self, $query, $opts);
+}
+
 sub lookup_skeleton {
 	my ($self, $mid) = @_;
 	my $skel = $self->{skel} or return lookup_message($self, $mid);
diff --git a/t/nntpd.t b/t/nntpd.t
index ea0d293..de781d7 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -228,6 +228,8 @@ EOF
 	is_deeply($n->xhdr(qw(list-id 1-)), {},
 		 'XHDR on invalid header returns empty');
 
+	my $mids = $n->newnews(0, '*');
+	is_deeply($mids, ['<nntp@example.com>'], 'NEWNEWS works');
 	{
 		my $t0 = time;
 		my $date = $n->date;
-- 
EW


^ permalink raw reply related	[relevance 5%]

* [PATCH 1/2] search: drop pointless range processors for Unix timestamp
  2016-08-16  8:49  6% [PATCH 0/2] search: support YYYYMMDD search ranges Eric Wong
@ 2016-08-16  8:49  7% ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2016-08-16  8:49 UTC (permalink / raw)
  To: meta

The Unix timestamp isn't meaningful for users searching,
we will start indexing the YYYYMMDD date stamp which may
use StringValueRangeProcessor, instead.
---
 lib/PublicInbox/Search.pm | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 1398ea4..61f0338 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -179,8 +179,6 @@ sub qp {
 	$qp->set_database($self->{xdb});
 	$qp->set_stemmer($self->stemmer);
 	$qp->set_stemming_strategy(STEM_SOME);
-	$qp->add_valuerangeprocessor($self->ts_range_processor);
-	$qp->add_valuerangeprocessor($self->date_range_processor);
 
 	while (my ($name, $prefix) = each %bool_pfx_external) {
 		$qp->add_boolean_prefix($name, $prefix);
@@ -205,14 +203,6 @@ sub qp {
 	$self->{query_parser} = $qp;
 }
 
-sub ts_range_processor {
-	$_[0]->{tsrp} ||= Search::Xapian::NumberValueRangeProcessor->new(TS);
-}
-
-sub date_range_processor {
-	$_[0]->{drp} ||= Search::Xapian::DateValueRangeProcessor->new(TS);
-}
-
 sub num_range_processor {
 	$_[0]->{nrp} ||= Search::Xapian::NumberValueRangeProcessor->new(NUM);
 }
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] search: support YYYYMMDD search ranges
@ 2016-08-16  8:49  6% Eric Wong
  2016-08-16  8:49  7% ` [PATCH 1/2] search: drop pointless range processors for Unix timestamp Eric Wong
  0 siblings, 1 reply; 3+ results
From: Eric Wong @ 2016-08-16  8:49 UTC (permalink / raw)
  To: meta

Not deployed to clear-net sites, yet, I'm reindexing the
http://czquwvybam4bgbro.onion/git/ onion right now.

Eric Wong (2):
      search: drop pointless range processors for Unix timestamp
      search: add YYYYMMDD search range via "d:" prefix

 lib/PublicInbox/Search.pm    | 13 +++----------
 lib/PublicInbox/SearchIdx.pm |  7 ++++++-
 t/search.t                   |  9 +++++++++
 3 files changed, 18 insertions(+), 11 deletions(-)


^ permalink raw reply	[relevance 6%]

Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-08-16  8:49  6% [PATCH 0/2] search: support YYYYMMDD search ranges Eric Wong
2016-08-16  8:49  7% ` [PATCH 1/2] search: drop pointless range processors for Unix timestamp Eric Wong
2018-03-06  8:42     [v2 PATCH 00/34] duplicate handling, smaller Xapian DBs, date fixes Eric Wong (Contractor, The Linux Foundation)
2018-03-06  8:42  5% ` [PATCH 23/34] nntp: fix NEWNEWS command Eric Wong (Contractor, The Linux Foundation)

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).