-# ensure there's no stale Xapian docs by treating $over as canonical
-sub over_check {
- my ($self, $over) = @_;
- begin_txn_lazy($self);
- my $sth = $over->dbh->prepare(<<'');
-SELECT COUNT(*) FROM over WHERE num = ?
-
- my $xdb = $self->{xdb};
- my $cur = $xdb->postlist_begin('');
- my $end = $xdb->postlist_end('');
- my $xdir = $self->xdir;
- for (; $cur != $end; $cur++) {
- my $docid = $cur->get_docid;
- $sth->execute($docid);
- my $x = $sth->fetchrow_array;
- next if $x > 0;
- warn "I: removing $xdir #$docid, not in `over'\n";
- $xdb->delete_document($docid);
- }
-}
-