From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id BCB7B1FAEE for ; Thu, 15 Feb 2018 11:08:45 +0000 (UTC) From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Subject: [WIP 12/17] search: free up 'Q' prefix for a real unique identifier Date: Thu, 15 Feb 2018 11:08:35 +0000 Message-Id: <20180215110840.30413-13-e@80x24.org> In-Reply-To: <20180215110840.30413-1-e@80x24.org> References: <20180215105509.GA22409@dcvr> <20180215110840.30413-1-e@80x24.org> List-Id: This will allow easier-compatibility with v2 code which will introduce content_id as the unique identifier. The old "XMID" becomes "XM" as a free text searchable term. "Q" becomes "XMID" as a boolean prefix. There's no user-visible changes in this, but there needs to be a schema version bump later on... (more changes planned which can affect v1) --- lib/PublicInbox/Search.pm | 8 ++++---- lib/PublicInbox/SearchIdx.pm | 8 ++++---- lib/PublicInbox/SearchMsg.pm | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 9ab5afe..3ec96ca 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -56,13 +56,13 @@ my %bool_pfx_internal = ( ); my %bool_pfx_external = ( - mid => 'Q', # uniQue id (Message-ID) + mid => 'XMID', # uniQue id (Message-ID) ); my %prob_prefix = ( # for mairix compatibility s => 'S', - m => 'XMID', # 'mid:' (bool) is exact, 'm:' (prob) can do partial + m => 'XM', # 'mid:' (bool) is exact, 'm:' (prob) can do partial f => 'A', t => 'XTO', tc => 'XTO XCC', @@ -85,7 +85,7 @@ my %prob_prefix = ( dfblob => 'XDFPRE XDFPOST', # default: - '' => 'XMID S A XNQ XQUOT XFN', + '' => 'XM S A XNQ XQUOT XFN', ); # not documenting m: and mid: for now, the using the URLs works w/o Xapian @@ -285,7 +285,7 @@ sub lookup_message { my ($self, $mid) = @_; $mid = mid_clean($mid); - my $doc_id = $self->find_unique_doc_id('Q' . $mid); + my $doc_id = $self->find_unique_doc_id('XMID' . $mid); my $smsg; if (defined $doc_id) { # raises on error: diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 66faed3..0ee0779 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -276,7 +276,7 @@ sub add_message { } $smsg = PublicInbox::SearchMsg->new($mime); my $doc = $smsg->{doc}; - $doc->add_term('Q' . $mid); + $doc->add_term('XMID' . $mid); my $subj = $smsg->subject; if ($subj ne '') { @@ -334,7 +334,7 @@ sub add_message { }); link_message($self, $smsg, $old_tid); - $tg->index_text($mid, 1, 'XMID'); + $tg->index_text($mid, 1, 'XM'); $doc->set_data($smsg->to_doc_data($blob)); if (my $altid = $self->{-altid}) { @@ -366,7 +366,7 @@ sub remove_message { $mid = mid_clean($mid); eval { - $doc_id = $self->find_unique_doc_id('Q' . $mid); + $doc_id = $self->find_unique_doc_id('XMID' . $mid); if (defined $doc_id) { $db->delete_document($doc_id); } else { @@ -683,7 +683,7 @@ sub create_ghost { my $tid = $self->next_thread_id; my $doc = Search::Xapian::Document->new; - $doc->add_term('Q' . $mid); + $doc->add_term('XMID' . $mid); $doc->add_term('G' . $tid); $doc->add_term('T' . 'ghost'); diff --git a/lib/PublicInbox/SearchMsg.pm b/lib/PublicInbox/SearchMsg.pm index 70aa706..25c1abb 100644 --- a/lib/PublicInbox/SearchMsg.pm +++ b/lib/PublicInbox/SearchMsg.pm @@ -157,7 +157,7 @@ sub mid ($;$) { } elsif (my $rv = $self->{mid}) { $rv; } else { - $self->{mid} = _get_term_val($self, 'Q', qr/\AQ/) || + $self->{mid} = _get_term_val($self, 'XMID', qr/\AXMID/) || $self->_extract_mid; } } -- EW