]> Sergey Matveev's repositories - public-inbox.git/commitdiff
searchidx: increase term positions for all text terms
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Wed, 18 Apr 2018 09:13:16 +0000 (09:13 +0000)
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Wed, 18 Apr 2018 09:14:20 +0000 (09:14 +0000)
We do not want phrase searches to cross between independent
fields (filenames/Message-ID vs bodies)

lib/PublicInbox/SearchIdx.pm

index 2239c90209579e42c590c8e0df113ab53617879b..6e44887d2651c2b20fef84e8a7d38369badf607e 100644 (file)
@@ -295,6 +295,7 @@ sub add_message {
                        my $fn = $part->filename;
                        if (defined $fn && $fn ne '') {
                                $tg->index_text($fn, 1, 'XFN');
                        my $fn = $part->filename;
                        if (defined $fn && $fn ne '') {
                                $tg->index_text($fn, 1, 'XFN');
+                               $tg->increase_termpos;
                        }
 
                        return if $ct =~ m!\btext/x?html\b!i;
                        }
 
                        return if $ct =~ m!\btext/x?html\b!i;
@@ -330,6 +331,7 @@ sub add_message {
 
                foreach my $mid (@$mids) {
                        $tg->index_text($mid, 1, 'XM');
 
                foreach my $mid (@$mids) {
                        $tg->index_text($mid, 1, 'XM');
+                       $tg->increase_termpos;
                }
                $smsg->{to} = $smsg->{cc} = '';
                PublicInbox::OverIdx::parse_references($smsg, $mid0, $mids);
                }
                $smsg->{to} = $smsg->{cc} = '';
                PublicInbox::OverIdx::parse_references($smsg, $mid0, $mids);