From: Eric Wong <e@80x24.org> To: meta@public-inbox.org Subject: [PATCH 08/11] imap: drop old, pre-Parse::RecDescent search parser Date: Wed, 2 Sep 2020 11:04:18 +0000 Message-ID: <20200902110421.30905-9-e@80x24.org> (raw) In-Reply-To: <20200902110421.30905-1-e@80x24.org> We switched to Parse::RecDescent during development and left some dead code behind. --- lib/PublicInbox/IMAP.pm | 61 ----------------------------------------- 1 file changed, 61 deletions(-) diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index d540fd0b..2d0d005e 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -1109,67 +1109,6 @@ sub search_uid_range { # long_response 1; # more } -sub date_search { - my ($q, $k, $d) = @_; - my $sql = $q->{sql}; - - # Date: header - if ($k eq 'SENTON') { - my $end = $d + 86399; # no leap day... - my $da = strftime('%Y%m%d%H%M%S', gmtime($d)); - my $db = strftime('%Y%m%d%H%M%S', gmtime($end)); - $q->{xap} .= " dt:$da..$db"; - $$sql .= " AND ds >= $d AND ds <= $end" if defined($sql); - } elsif ($k eq 'SENTBEFORE') { - $q->{xap} .= ' d:..'.strftime('%Y%m%d', gmtime($d)); - $$sql .= " AND ds <= $d" if defined($sql); - } elsif ($k eq 'SENTSINCE') { - $q->{xap} .= ' d:'.strftime('%Y%m%d', gmtime($d)).'..'; - $$sql .= " AND ds >= $d" if defined($sql); - - # INTERNALDATE (Received) - } elsif ($k eq 'ON') { - my $end = $d + 86399; # no leap day... - $q->{xap} .= " ts:$d..$end"; - $$sql .= " AND ts >= $d AND ts <= $end" if defined($sql); - } elsif ($k eq 'BEFORE') { - $q->{xap} .= " ts:..$d"; - $$sql .= " AND ts <= $d" if defined($sql); - } elsif ($k eq 'SINCE') { - $q->{xap} .= " ts:$d.."; - $$sql .= " AND ts >= $d" if defined($sql); - } else { - die "BUG: $k not recognized"; - } -} - -# IMAP to Xapian search key mapping -my %I2X = ( - SUBJECT => 's:', - BODY => 'b:', - FROM => 'f:', - TEXT => '', # n.b. does not include all headers - TO => 't:', - CC => 'c:', - # BCC => 'bcc:', # TODO - # KEYWORD # TODO ? dfpre,dfpost,... -); - -# IMAP allows searching arbitrary headers via "HEADER $HDR_NAME $HDR_VAL" -# which gets silly expensive. We only allow the headers we already index. -my %H2X = (%I2X, 'MESSAGE-ID' => 'm:', 'LIST-ID' => 'l:'); - -sub xap_append ($$$$) { - my ($q, $rest, $k, $xk) = @_; - delete $q->{sql}; # can't use over.sqlite3 - defined(my $arg = shift @$rest) or return "BAD $k no arg"; - - # AFAIK Xapian can't handle [*"] in probabilistic terms - $arg =~ tr/*"//d; - ${$q->{xap}} .= qq[ $xk"$arg"]; - undef; -} - sub parse_query ($$) { my ($self, $query) = @_; my $q = PublicInbox::IMAPsearchqp::parse($self, $query);
next prev parent reply other threads:[~2020-09-02 11:04 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-02 11:04 [PATCH 00/11] cleanups, mostly indexing related Eric Wong 2020-09-02 11:04 ` [PATCH 01/11] msgmap: note how we use ->created_at Eric Wong 2020-09-02 11:04 ` [PATCH 02/11] disambiguate OverIdx and Over by field name Eric Wong 2020-09-02 11:04 ` [PATCH 03/11] use more idiomatic internal API for ->over access Eric Wong 2020-09-02 11:04 ` [PATCH 04/11] search: remove special case for blank query Eric Wong 2020-09-02 11:04 ` [PATCH 05/11] tests: add "use strict" and declare v5.10.1 compatibility Eric Wong 2020-09-02 11:04 ` [PATCH 06/11] search: replace ->query with ->mset Eric Wong 2020-09-02 11:04 ` [PATCH 07/11] search: remove {over_ro} field Eric Wong 2020-09-02 11:04 ` Eric Wong [this message] 2020-09-02 11:04 ` [PATCH 09/11] wwwaltid: drop unused sqlite3_missing function Eric Wong 2020-09-02 11:04 ` [PATCH 10/11] overidx: document column uses Eric Wong 2020-09-02 11:04 ` [PATCH 11/11] v2writable: reuse read-only shard counting code Eric Wong
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: http://public-inbox.org/README * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200902110421.30905-9-e@80x24.org \ --to=e@80x24.org \ --cc=meta@public-inbox.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
user/dev discussion of public-inbox itself This inbox may be cloned and mirrored by anyone: git clone --mirror http://public-inbox.org/meta git clone --mirror http://czquwvybam4bgbro.onion/meta git clone --mirror http://hjrcffqmbrq6wope.onion/meta git clone --mirror http://ou63pmih66umazou.onion/meta # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V1 meta meta/ http://public-inbox.org/meta \ meta@public-inbox.org public-inbox-index meta Example config snippet for mirrors. Newsgroups are available over NNTP: nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta nntp://news.gmane.io/gmane.mail.public-inbox.general note: .onion URLs require Tor: https://www.torproject.org/ code repositories for the project(s) associated with this inbox: https://80x24.org/public-inbox.git AGPL code for this site: git clone https://public-inbox.org/public-inbox.git