Branch Coverage

blib/lib/Search/Elasticsearch/Compat/QueryParser.pm
Criterion Covered Total %
branch 153 160 95.6


line true false branch
60 0 194 unless defined $text
75 8 136 unless $$self{'_done'} or $$opts{'fix'}
78 58 136 if ($@)
91 0 0 unless defined $text
108 883 257 if $next
182 255 856 unless my $token = $self->_next_token
186 666 190 if ($$allowed{$type}) { }
17 173 elsif (defined $$allowed{$type}) { }
187 160 506 if $type eq '_SPACE'
191 8 9 unless $$self{'_opts'}{'fix'}
208 173 292 unless (defined $clause)
210 143 9 if @{$$self{'_stack'};} > 1 or not $$self{'_opts'}{'fix'} or $$self{'_done'}
216 28 264 unless length $clause
230 8 37 unless ($$self{'_stack'}[-1]{'clauses'})
231 4 4 if $$opts{'fix'}
234 3 34 unless ($$opts{'allow_bool'})
235 1 2 unless $$opts{'fix'}
240 26 4 if defined $next and length $next
243 2 2 if $$opts{'fix'}
254 3 24 unless ($$opts{'allow_bool'})
255 1 2 unless $$opts{'fix'}
260 4 17 unless defined $next
262 1 20 if $next =~ s/^[+-]+// and not $$opts{'fix'}
265 16 4 if length $next
268 2 2 if $$opts{'fix'}
279 17 3 if defined $next and length $next
281 2 1 if $$self{'_opts'}{'fix'}
294 18 2 if ($rparen and $$rparen[0] eq '_RPAREN') { }
1 1 elsif ($$self{'_opts'}{'fix'}) { }
296 7 11 if $next
305 19 0 $clause ? :
312 7 39 unless ($$self{'_opts'}{'allow_boost'})
313 3 4 unless $$self{'_opts'}{'fix'}
317 4 35 unless (defined $val and length $val)
318 2 2 if $$self{'_opts'}{'fix'}
332 21 19 if ($$self{'current'} eq '_PHRASE') { }
335 17 4 if ($$opts{'allow_slop'}) { }
337 11 6 $fuzzy ? :
340 2 2 unless $fix
347 15 4 if ($$opts{'allow_fuzzy'}) { }
348 11 4 if (defined $fuzzy) { }
349 9 2 if ($fuzzy <= 1) { }
353 1 1 unless $fix
363 2 2 unless $fix
394 5 9 unless ($$opts{'fields'} and !ref($$opts{'fields'}) || $$opts{'fields'}{$field})
397 3 2 if $$opts{'fix'}
401 6 3 if $field
403 2 1 if $$self{'_opts'}{'fix'}
416 0 18 unless (defined $next and length $next)
417 0 0 unless $$opts{'fix'}
422 8 8 if $$opts{'fields'} and !ref($$opts{'fields'}) || $$opts{'fields'}{$field}
426 5 5 unless $$opts{'fix'}
448 5 8 unless ($term =~ /^[^*?]{$min}/)
449 1 1 $min == 1 ? :
2 3 unless $$self{'_opts'}{'fix'}
454 1 2 unless length $term
466 2 24 unless ($$opts{'allow_ranges'})
467 1 1 unless $$opts{'fix'}
471 4 20 unless (defined $to)
472 2 2 unless $$opts{'fix'}
483 5 5 unless $$self{'_opts'}{'fix'}
485 1 4 $$self{'_opts'}{'escape_reserved'} ? :
494 1 1 unless $$self{'_opts'}{'fix'}
520 180 866 if $text =~ /\G$WS/cg
522 61 805 if $text =~ /\G(AND\b | && | OR\b | \|{2})/cgx
524 31 774 if $text =~ /\G(NOT\b | !)/cgx
526 26 748 if $text =~ /\G([-+])/cg
528 21 727 if $text =~ /\G[(]/cg
530 21 706 if $text =~ /\G[)]/cg
532 52 654 if $text =~ /\G\^($DECIMAL)?/cg
534 51 603 if $text =~ /\G[~]($DECIMAL)?/cg
536 29 574 if $text =~ /\G " ( (?: $ESC_CHAR | [^"\\])*) "/cgx
538 16 558 if $text =~ /\G (_exists_|_missing_): ((?:$TERM_START_CHAR $TERM_CHAR*)?) /cgx
543 19 539 if $text =~ /\G ($TERM_START_CHAR $TERM_CHAR*):/cgx
545 201 338 if $text =~ /\G ( $TERM_START_CHAR $TERM_CHAR*) (?!$TERM_CHAR | [*?]) /cgx
550 17 321 if $text =~ /\G ( (?:$TERM_START_CHAR | [*?]) (?:$TERM_CHAR | [*?])* )/cgx
555 28 293 if $text =~ /\G \[ ( $QUOTE_RANGE | [^ \]]+ ) (?: $RANGE_SEP ( $QUOTE_RANGE | [^ \]]* ) )? \] /cgx
563 2 291 if $text =~ /\G \{ ( $QUOTE_RANGE | [^ }]+ ) (?: $RANGE_SEP ( $QUOTE_RANGE | [^ }]* ) )? \} /cgx
573 18 273 if $text =~ /\G ( ["&|!(){}[\]~^:+\-] )/cgx
576 3 270 if $text =~ /\G\\$/cg