From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.4 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C62461F825 for ; Mon, 17 Aug 2015 03:38:24 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 9/9] search: apply mid_compression to subject paths, too Date: Mon, 17 Aug 2015 03:38:17 +0000 Message-Id: <1439782697-16412-10-git-send-email-e@80x24.org> In-Reply-To: <1439782697-16412-1-git-send-email-e@80x24.org> References: <1439782697-16412-1-git-send-email-e@80x24.org> List-Id: Otherwise we'll be wasting space in our index for long subjects. --- lib/PublicInbox/Search.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 051f7a5..862ed6d 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -15,7 +15,8 @@ use constant { # SCHEMA_VERSION history # 0 - initial # 1 - subject_path is lower-cased - SCHEMA_VERSION => 1, + # 2 - subject_path is mid_compressed in the index, only + SCHEMA_VERSION => 2, LANG => 'english', QP_FLAGS => FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE|FLAG_WILDCARD, }; @@ -113,7 +114,7 @@ sub add_message { $doc->add_term(xpfx('subject') . $subj); my $path = subject_path($subj); - $doc->add_term(xpfx('path') . $path); + $doc->add_term(xpfx('path') . mid_compressed($path)); } my $from = $smsg->from_name; @@ -214,7 +215,7 @@ sub query { sub get_subject_path { my ($self, $path, $opts) = @_; - my $query = $self->qp->parse_query("path:$path", 0); + my $query = $self->qp->parse_query("path:".mid_compressed($path), 0); $self->do_enquire($query); } @@ -238,7 +239,7 @@ sub get_thread { return { count => 0, msgs => [] } unless $smsg; my $qp = $self->qp; my $qtid = $qp->parse_query('thread:'.$smsg->thread_id); - my $qsub = $qp->parse_query('path:'.$smsg->path); + my $qsub = $qp->parse_query('path:'.mid_compressed($smsg->path)); my $query = Search::Xapian::Query->new(OP_OR, $qtid, $qsub); $self->do_enquire($query); } -- EW