about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchIdx.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-15 09:52:53 +0000
committerEric Wong <e@80x24.org>2021-10-15 15:58:01 +0000
commitea11b7b17d525d20a07d7f62c0334501c5a721b4 (patch)
tree4f6df4242be888948e9879d10cd59ebb9323fd6d /lib/PublicInbox/SearchIdx.pm
parent738c4a65719e62784fe6baf3781c626b17f3783d (diff)
downloadpublic-inbox-ea11b7b17d525d20a07d7f62c0334501c5a721b4.tar.gz
When importing several sources in parallel via http(s) mboxrd,
we need to be able to get keywords of uncommitted documents
directly from shard workers.  Otherwise, Xapian DocNotFound
errors happen because the read-only LeiSearch won't see
documents from uncomitted transactions.  Keep in mind that it's
possible the keywords can be changed on-the-fly even for
uncommitted documents because of inotify watches from LeiNoteEvent.
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
-rw-r--r--lib/PublicInbox/SearchIdx.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 928152ec..585f28f5 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -517,6 +517,12 @@ sub add_eidx_info {
         $self->{xdb}->replace_document($docid, $doc);
 }
 
+sub get_terms {
+        my ($self, $pfx, $docid) = @_;
+        begin_txn_lazy($self);
+        xap_terms($pfx, $self->{xdb}, $docid);
+}
+
 sub remove_eidx_info {
         my ($self, $docid, $eidx_key, $eml) = @_;
         begin_txn_lazy($self);