From 4d594e98063aaad1ce9a90709af7edc5c44a0163 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 23 Jun 2021 07:14:20 -0400 Subject: search: make xap_terms easier-to-use and use it more This allows us to simplify callers throughout, and exceptions are can no longer be silently hidden. MiscSearch now uses xap_terms for looking up eidx_key terms for a code reduction. We also simplify LeiStore->_msg_kw for runtime use by moving the MsetIterator handling into t/lei_store.t test case. --- lib/PublicInbox/SearchIdx.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/SearchIdx.pm') diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index f553eda6..65764cc8 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -435,8 +435,9 @@ sub add_xapian ($$$$) { if (my $old = $merge_vmd ? _get_doc($self, $smsg->{num}) : undef) { my @x = @VMD_MAP; while (my ($field, $pfx) = splice(@x, 0, 2)) { - my $vals = xap_terms($pfx, $old); - $doc->add_boolean_term($pfx.$_) for keys %$vals; + for my $term (xap_terms($pfx, $old)) { + $doc->add_boolean_term($pfx.$term); + } } } $self->{xdb}->replace_document($smsg->{num}, $doc); -- cgit v1.2.3-24-ge0c7