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;

Reply via email to