diff options
author | Eric Wong <e@80x24.org> | 2021-04-24 10:23:30 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-04-24 16:10:04 -0400 |
commit | 1c0dce28a8604b16488ea7416dcf1bddd66a5d42 (patch) | |
tree | 2ff3d81eba6b4ee1e2c9113763cb20bf0b4c782b /lib/PublicInbox | |
parent | b6b86cfd238c170ea3e2c4d4179f06c7af139086 (diff) | |
download | public-inbox-1c0dce28a8604b16488ea7416dcf1bddd66a5d42.tar.gz |
This allows us to handle odd inboxes w/o a newsgroup configured if they also make the strange choice of having backslashes in their path name. Also, ensure we use case-sensitive LIKE, since case-insensitive FSes are not worth supporting.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/ExtSearchIdx.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index a17e7579..9d6b3b9d 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -336,9 +336,11 @@ sub eidx_gc { $self->idx_init($opt); # acquire lock via V2Writable::_idx_init my $dbh = $self->{oidx}->dbh; + $dbh->do('PRAGMA case_sensitive_like = ON'); # only place we use LIKE my $x3_doc = $dbh->prepare('SELECT docid FROM xref3 WHERE ibx_id = ?'); my $ibx_ck = $dbh->prepare('SELECT ibx_id,eidx_key FROM inboxes'); - my $lc_i = $dbh->prepare('SELECT key FROM eidx_meta WHERE key LIKE ?'); + my $lc_i = $dbh->prepare(<<''); +SELECT key FROM eidx_meta WHERE key LIKE ? ESCAPE ? $ibx_ck->execute; while (my ($ibx_id, $eidx_key) = $ibx_ck->fetchrow_array) { @@ -354,8 +356,8 @@ DELETE FROM inboxes WHERE ibx_id = ? # drop last_commit info my $pat = $eidx_key; - $pat =~ s/([_%])/\\$1/g; - $lc_i->execute("lc-%:$pat//%"); + $pat =~ s/([_%\\])/\\$1/g; + $lc_i->execute("lc-%:$pat//%", '\\'); while (my ($key) = $lc_i->fetchrow_array) { next if $key !~ m!\Alc-v[1-9]+:\Q$eidx_key\E//!; warn "I: removing $key\n"; |