]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchIdx.pm
search: move find_doc_ids to searchidx
[public-inbox.git] / lib / PublicInbox / SearchIdx.pm
index 7ac16ec283bf6c059c2f7ac14a12706da5f6f319..a234c8c32384264853b35bc6b476660c950cb89f 100644 (file)
@@ -389,6 +389,14 @@ sub add_message {
        $doc_id;
 }
 
+# returns begin and end PostingIterator
+sub find_doc_ids {
+       my ($self, $termval) = @_;
+       my $db = $self->{xdb};
+
+       ($db->postlist_begin($termval), $db->postlist_end($termval));
+}
+
 sub batch_do {
        my ($self, $termval, $cb) = @_;
        my $batch_size = 1000; # don't let @ids grow too large to avoid OOM
@@ -561,6 +569,10 @@ sub link_and_save {
                        1;
                });
        }
+       if ($vivified > 1) {
+               my $id = '<'.join('> <', @$mids).'>';
+               warn "BUG: vivified multiple ($vivified) ghosts for $id\n";
+       }
        # not really important, but we return any vivified ghost docid, here:
        return $doc_id if defined $doc_id;
        link_doc($self, $doc, $refs, $old_tid);