about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-03-21 23:07:17 +0000
committerEric Wong <e@80x24.org>2023-03-25 09:37:41 +0000
commit852c6ff55c8ac33882defd224fee169cb90caa26 (patch)
treeb34bd6f5a2775f592933f93c1e37f29d964d100d /lib/PublicInbox
parent9225145d3e98d83889065f6d4dc4913226e5f121 (diff)
downloadpublic-inbox-852c6ff55c8ac33882defd224fee169cb90caa26.tar.gz
This will be used for code_search, too.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/LeiSearch.pm14
-rw-r--r--lib/PublicInbox/Search.pm14
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/PublicInbox/LeiSearch.pm b/lib/PublicInbox/LeiSearch.pm
index 936c2751..ba4c4309 100644
--- a/lib/PublicInbox/LeiSearch.pm
+++ b/lib/PublicInbox/LeiSearch.pm
@@ -158,20 +158,6 @@ sub kw_changed {
         join("\0", @$new_kw_sorted) eq $cur_kw ? 0 : 1;
 }
 
-sub all_terms {
-        my ($self, $pfx) = @_;
-        my $xdb = $self->xdb;
-        my $cur = $xdb->allterms_begin($pfx);
-        my $end = $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;
-        }
-        wantarray ? (sort keys %ret) : \%ret;
-}
-
 sub qparse_new {
         my ($self) = @_;
         my $qp = $self->SUPER::qparse_new; # PublicInbox::Search
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index e858729a..7aba2445 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -553,4 +553,18 @@ sub num2docid ($$) {
         ($num - 1) * $nshard + $num % $nshard + 1;
 }
 
+sub all_terms {
+        my ($self, $pfx) = @_;
+        my $cur = xdb($self)->allterms_begin($pfx);
+        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;
+        }
+        wantarray ? (sort keys %ret) : \%ret;
+}
+
+
 1;