about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiSavedSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-08-19 01:36:38 +0000
committerEric Wong <e@80x24.org>2021-08-19 09:48:10 +0000
commitd99020ac3612308d04e3760bd780417218748168 (patch)
treed55cd93ee4ba0b11e8910bdb8328a5c215560c0c /lib/PublicInbox/LeiSavedSearch.pm
parent706888be614a26b91be75d39578b9db26772bd00 (diff)
downloadpublic-inbox-d99020ac3612308d04e3760bd780417218748168.tar.gz
Since "lei up" is more often useful than not and incurs neglible
overhead; enable --save by default and allow --no-save to work.

This also fixes a long-standing when overwriting --output
destinations with saved searches:  dedupe data from previous
searches are reset and no longer influences the new (changed)
search, so results no longer go missing if two sequential
invocations of "lei q --save" point to the same --output.
Diffstat (limited to 'lib/PublicInbox/LeiSavedSearch.pm')
-rw-r--r--lib/PublicInbox/LeiSavedSearch.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiSavedSearch.pm b/lib/PublicInbox/LeiSavedSearch.pm
index 2a0e9321..fd51fe38 100644
--- a/lib/PublicInbox/LeiSavedSearch.pm
+++ b/lib/PublicInbox/LeiSavedSearch.pm
@@ -243,6 +243,16 @@ sub pause_dedupe {
         $oidx->commit_lazy;
 }
 
+sub reset_dedupe {
+        my ($self) = @_;
+        prepare_dedupe($self);
+        my $lk = $self->lock_for_scope_fast;
+        for my $t (qw(xref3 over id2num)) {
+                $self->{oidx}->{dbh}->do("DELETE FROM $t");
+        }
+        pause_dedupe($self);
+}
+
 sub mm { undef }
 
 sub altid_map { {} }