From: Eric Wong Date: Wed, 16 Aug 2023 08:07:12 +0000 (+0000) Subject: search: all_terms: remove needless prefix check X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80fe3f8e6890ac769484288383a52894572e6e15;p=thirdparty%2Fpublic-inbox.git 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}) --- diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index a4fef17ba..b2de34507 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;