From 80fe3f8e6890ac769484288383a52894572e6e15 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 16 Aug 2023 08:07:12 +0000 Subject: search: all_terms: remove needless prefix check 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(-) (limited to 'lib/PublicInbox/Search.pm') 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; -- cgit v1.2.3-24-ge0c7