about summary refs log tree commit homepage
path: root/lib/PublicInbox/ExtSearchIdx.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-10 14:25:16 +0000
committerEric Wong <e@80x24.org>2021-10-10 23:29:54 +0000
commit341af725ce7ca711e7e5906138459854a3101309 (patch)
treeab3e4185f5d34db9c18491ffba4cb2fc7edf5768 /lib/PublicInbox/ExtSearchIdx.pm
parent9bc14f521223d63697a2f13986c71f4b0226e21b (diff)
downloadpublic-inbox-341af725ce7ca711e7e5906138459854a3101309.tar.gz
We were deleting ghost entries, this was usually harmless since
other messages could fill-in-the-blanks, but could cause
misthreading in odd cases where a big chunk of a thread is
missing and the latest messages only referenced ghosts.

We'll also save some cycles when scanning Xapian shards since
docids won't be <= 0.
Diffstat (limited to 'lib/PublicInbox/ExtSearchIdx.pm')
-rw-r--r--lib/PublicInbox/ExtSearchIdx.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index 42488e12..acf35e3d 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -425,13 +425,13 @@ DELETE FROM xref3 WHERE docid NOT IN (SELECT num FROM over)
 
         # fixup from old bugs:
         $nr = $self->{oidx}->dbh->do(<<'');
-DELETE FROM over WHERE num NOT IN (SELECT docid FROM xref3)
+DELETE FROM over WHERE num > 0 AND num NOT IN (SELECT docid FROM xref3)
 
         warn "I: eliminated $nr stale over entries\n" if $nr != 0;
         reindex_checkpoint($self, $sync) if checkpoint_due($sync);
 
         my ($cur) = $self->{oidx}->dbh->selectrow_array(<<EOM);
-SELECT MIN(num) FROM over
+SELECT MIN(num) FROM over WHERE num > 0
 EOM
         $cur // return; # empty
         my ($r, $n, %active);