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] search: all_terms: remove needless prefix check
@ 2023-08-16  8:07  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2023-08-16  8:07 UTC (permalink / raw)
  To: meta

The ->allterms_{begin,end} methods of Xapian::Database already
filter match on prefix natively.   Thus there's no need to do
filtering ourselves (unlike per-document ->termlist_{begin/end})
---
 lib/PublicInbox/Search.pm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index a4fef17b..b2de3450 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -576,12 +576,9 @@ sub all_terms {
 	my $end = $self->{xdb}->allterms_end($pfx);
 	my %ret;
 	for (; $cur != $end; $cur++) {
-		my $tn = $cur->get_termname;
-		index($tn, $pfx) == 0 and
-			$ret{substr($tn, length($pfx))} = undef;
+		$ret{substr($cur->get_termname, length($pfx))} = undef;
 	}
 	wantarray ? (sort keys %ret) : \%ret;
 }
 
-
 1;

^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-08-16  8:07  7% [PATCH] search: all_terms: remove needless prefix check Eric Wong

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).