about summary refs log tree commit homepage
path: root/lib/PublicInbox/Search.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-09-09 00:01:25 +0000
committerEric Wong <e@80x24.org>2016-09-09 00:02:19 +0000
commit21ab8f3cc530d9483091f32c0865ba1ce867cef8 (patch)
tree6b2c33e88d50e2cf76ae399ee2af497c86337e96 /lib/PublicInbox/Search.pm
parenta9c903a57ff9a18c56a53bcba4316eade423fef6 (diff)
downloadpublic-inbox-21ab8f3cc530d9483091f32c0865ba1ce867cef8.tar.gz
As of Xapian 1.0.4 (from 2007) is possible to use
Search::Xapian::QueryParser::add_prefix multiple times with the
same user field name but different term prefixes.

This brings my current git@vger mirror from 6.5GB to 2.1GB
(both sizes are after xapian-compact).
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r--lib/PublicInbox/Search.pm15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index f74129d5..c8e297f4 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -60,20 +60,23 @@ my %bool_pfx_external = (
 my %prob_prefix = (
         # for mairix compatibility
         s => 'S',
-        m => 'Q', # 'mid' is exact, 'm' can do partial
+        m => 'XMID', # 'mid:' (bool) is exact, 'm:' (prob) can do partial
         f => 'A',
         t => 'XTO',
-        tc => 'XTC',
+        tc => 'XTO XCC',
         c => 'XCC',
-        tcf => 'XTCF',
-        b => 'XBODY',
-        bs => 'XBS',
+        tcf => 'XTO XCC A',
+        b => 'XNQ XQUOT',
+        bs => 'XNQ XQUOT S',
 
         # n.b.: leaving out "a:" alias for "tcf:" even though
         # mairix supports it.  It is only mentioned in passing in mairix(1)
         # and the extra two letters are not significantly longer.
         q => 'XQUOT',
         nq => 'XNQ',
+
+        # default:
+        '' => 'XMID S A XNQ XQUOT',
 );
 
 # not documenting m: and mid: for now, the using the URLs works w/o Xapian
@@ -241,7 +244,7 @@ EOF
         }
 
         while (my ($name, $prefix) = each %prob_prefix) {
-                $qp->add_prefix($name, $prefix);
+                $qp->add_prefix($name, $_) foreach split(/ /, $prefix);
         }
 
         $self->{query_parser} = $qp;