« blib/lib/ElasticSearchX/Model/Document/Role.pm
↑ Summary
blib/lib/ElasticSearchX/Model/Trait/Class.pm »
| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # This file is part of ElasticSearchX-Model | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # This software is Copyright (c) 2018 by Moritz Onken. | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # This is free software, licensed under: | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # The (three-clause) BSD License | ||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 10 | package ElasticSearchX::Model::Document::Mapping; | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 10 | $ElasticSearchX::Model::Document::Mapping::VERSION = '1.0.3'; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 10 | ▶ | use Moose::Util::TypeConstraints; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | our %MAPPING = (); | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | sub maptc { | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 87 | ▶ | my ( $attr, $constraint ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
maptc: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 87 | ▶ | $constraint ||= find_type_constraint('Str'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$constraint ||= find_type_constraint("Str")
MC/DC0%0/2
$constraint ||= find_type_constraint("Str")
$constraint
find_type_constraint("Str")
Truth table66%2/3
A ||= B
A= $constraintB= find_type_constraint("Str")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 87 | ( my $name = $constraint->name ) =~ s/\[.*\]/\[\]/; | |||||||||||||||||||||||||||||||||||||||||||||
| 22 | 87 | my $sub = $MAPPING{$name}; | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | 87 | my %ret; | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | 87 | ▶ | if ( !$sub && $constraint->has_parent ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
not $sub and $constraint->has_parent
MC/DC50%1/2
not $sub and $constraint->has_parent
not $sub
$constraint->has_parent
Truth table66%2/3
not(A) and B
A= not $subB= $constraint->has_parent
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 45 | %ret = maptc( $attr, $constraint->parent ); | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | elsif ($sub) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 42 | %ret = $sub->( $attr, $constraint ); | |||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 87 | ▶ | if ( $ret{type} ne 'string' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 20 | delete $ret{ignore_above}; | |||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 87 | return %ret; | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | $MAPPING{Any} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 12 | ▶ | my ( $attr, $tc ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 12 | ▶ | my %mapping = ( | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | $attr->index ? ( index => $attr->index ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | $attr->type eq 'object' ? ( dynamic => $attr->dynamic ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | $attr->boost ? ( boost => $attr->boost ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | !$attr->include_in_all ? ( include_in_all => \0 ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | type => 'string', | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | $attr->analyzer->[0] ? ( analyzer => $attr->analyzer->[0] ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 12 | return _set_doc_values(%mapping); | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | $MAPPING{Str} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 13 | ▶ | my ( $attr, $tc ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=12 SCAR=26.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 13 | ▶ | my %term | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | = $attr->term_vector ? ( term_vector => $attr->term_vector ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 13 | ▶ | if ( $attr->index && $attr->index eq 'analyzed' || @{ $attr->analyzer } ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$attr->index and $attr->index eq "analyzed" or @{$attr->analyzer;}
$attr->index and $attr->index eq "analyzed"
MC/DC66%2/3
$attr->index and $attr->index eq "analyzed" or @{$attr->analyzer;}
$attr->index
$attr->index eq "analyzed"
@{$attr->analyzer;}
Truth table60%3/5
A and B or C
A= $attr->indexB= $attr->index eq "analyzed"C= @{$attr->analyzer;}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 5 | my @analyzer = @{ $attr->{analyzer} }; | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | 5 | ▶ | push( @analyzer, 'standard' ) unless (@analyzer); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | return _set_doc_values( | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | type => 'multi_field', | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | fields => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | $attr->not_analyzed | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | ? ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | $attr->name => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | index => 'not_analyzed', | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ignore_above => 2048, | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | doc_values => \1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | !$attr->include_in_all | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ? ( include_in_all => \0 ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | $attr->boost ? ( boost => $attr->boost ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | type => $attr->type, | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | : () | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | ), | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | analyzed => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | store => $attr->store, | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | index => 'analyzed', | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | type => $attr->type, | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | $attr->boost ? ( boost => $attr->boost ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | %term, | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | analyzer => shift @analyzer, | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | $attr->type eq 'string' | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | ? ( fielddata => { format => 'disabled' } ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | map { | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 5 | ▶ | $_ => { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | store => $attr->store, | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | index => 'analyzed', | ||||||||||||||||||||||||||||||||||||||||||||||
| 96 | type => $attr->type, | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | $attr->boost ? ( boost => $attr->boost ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | %term, | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | analyzer => $_ | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } @analyzer | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 8 | return _set_doc_values( | |||||||||||||||||||||||||||||||||||||||||||||
| 107 | index => 'not_analyzed', | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | ignore_above => 2048, | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | %term, maptc( $attr, $tc->parent ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | $MAPPING{Num} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | my ( $attr, $tc ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | return _set_doc_values( maptc( $attr, $tc->parent ), type => 'float' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||
| 118 | $MAPPING{Int} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | my ( $attr, $tc ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | return _set_doc_values( maptc( $attr, $tc->parent ), type => 'integer' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 121 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | $MAPPING{Bool} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | my ( $attr, $tc ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | return _set_doc_values( maptc( $attr, $tc->parent ), type => 'boolean' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | $MAPPING{ScalarRef} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | my ( $attr, $tc ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | return maptc( $attr, find_type_constraint('Str') ); | |||||||||||||||||||||||||||||||||||||||||||||
| 131 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | $MAPPING{ArrayRef} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 1 | ▶ | my ( $attr, $tc ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | return maptc( $attr, find_type_constraint('Str') ); | |||||||||||||||||||||||||||||||||||||||||||||
| 136 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | $MAPPING{'ArrayRef[]'} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 4 | ▶ | my ( $attr, $tc ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 4 | my $param = $tc->type_parameter; | |||||||||||||||||||||||||||||||||||||||||||||
| 141 | 4 | return maptc( $attr, $param ); | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | $MAPPING{'MooseX::Types::Structured::Dict[]'} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 3 | ▶ | my ( $attr, $constraint ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 3 | my %constraints = @{ $constraint->type_constraints }; | |||||||||||||||||||||||||||||||||||||||||||||
| 147 | 3 | my $value = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 148 | 3 | ▶ | while ( my ( $k, $v ) = each %constraints ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 6 | $value->{$k} = { maptc( $attr, $v ) }; | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 3 | my %mapping = maptc( $attr, $constraint->parent ); | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | 3 | delete $mapping{$_} for (qw(index boost store)); | |||||||||||||||||||||||||||||||||||||||||||||
| 153 | return ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 3 | ▶ | %mapping, | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | type => $attr->type eq 'nested' ? 'nested' : 'object', | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | dynamic => \( $attr->dynamic ), | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | properties => $value, | ||||||||||||||||||||||||||||||||||||||||||||||
| 158 | $attr->include_in_root ? ( include_in_root => \1 ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 159 | $attr->include_in_parent ? ( include_in_parent => \1 ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | $MAPPING{'MooseX::Types::Structured::Optional[]'} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 3 | ▶ | my ( $attr, $constraint ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 3 | return maptc( $attr, $constraint->type_parameter ); | |||||||||||||||||||||||||||||||||||||||||||||
| 166 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | $MAPPING{'MooseX::Types::ElasticSearch::Location'} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | ▶ | my ( $attr, $tc ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 1 | my %mapping = maptc( $attr, $tc->parent ); | |||||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | delete $mapping{$_} for (qw(index store)); | |||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | return ( %mapping, type => 'geo_point', doc_values => \1 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 173 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||
| 175 | $MAPPING{'ElasticSearchX::Model::Document::Types::Type[]'} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 4 | ▶ | my ( $attr, $constraint ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||||||||||||||||||||
| 177 | return ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 4 | ▶ | %{ $constraint->type_parameter->class->meta->mapping }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 179 | dynamic => \( $attr->dynamic ), | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | $attr->include_in_root ? ( include_in_root => \1 ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | $attr->include_in_parent ? ( include_in_parent => \1 ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | type => $attr->type eq 'nested' ? 'nested' : 'object', | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | $MAPPING{'DateTime'} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | ▶ | my ( $attr, $tc ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1 | return _set_doc_values( | |||||||||||||||||||||||||||||||||||||||||||||
| 189 | maptc( $attr, $tc->parent ), | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | type => 'date', | ||||||||||||||||||||||||||||||||||||||||||||||
| 191 | doc_values => \1 | ||||||||||||||||||||||||||||||||||||||||||||||
| 192 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||
| 195 | sub _set_doc_values { | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 26 | ▶ | my %mapping = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_doc_values: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 26 | ▶ | if ( $mapping{type} eq 'string' | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%5/5
$mapping{"type"} eq "string" and ($mapping{"index"} || "analyzed") eq "analyzed"
$mapping{'index'} || 'analyzed'
MC/DC100%2/2
$mapping{"type"} eq "string" and ($mapping{"index"} || "analyzed") eq "analyzed"
$mapping{"type"} eq "string"
$mapping{'index'}
Truth table100%3/3
A and B
A= $mapping{"type"} eq "string"B= $mapping{'index'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 199 | && ( $mapping{index} || 'analyzed' ) eq 'analyzed' ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 12 | delete $mapping{doc_values}; | |||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | elsif ( $mapping{type} eq 'multi_field' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 5 | delete $mapping{fielddata}; | |||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 9 | $mapping{doc_values} = \1; | |||||||||||||||||||||||||||||||||||||||||||||
| 208 | 9 | delete $mapping{fielddata}; | |||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 26 | return %mapping | |||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||
| 214 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||
| 216 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||
| 218 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||
| 220 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | ElasticSearchX::Model::Document::Mapping | ||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||
| 224 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||
| 226 | version 1.0.3 | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||
| 228 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||
| 230 | Moritz Onken | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||
| 232 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||
| 234 | This software is Copyright (c) 2018 by Moritz Onken. | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||
| 236 | This is free software, licensed under: | ||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | The (three-clause) BSD License | ||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||
| 240 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||