]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
search: all_terms: remove needless prefix check
authorEric Wong <e@80x24.org>
Wed, 16 Aug 2023 08:07:12 +0000 (08:07 +0000)
committerEric Wong <e@80x24.org>
Thu, 17 Aug 2023 07:22:08 +0000 (07:22 +0000)
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

index a4fef17ba50b5becaee72c71f0009ad18b71b17a..b2de3450710c5fc7fd4348398e16a8a8a9248cfc 100644 (file)
@@ -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;