Branch Coverage

blib/lib/Search/Query/Parser.pm
Criterion Covered Total %
branch 137 176 77.8


line true false branch
415 0 30 if (exists $args{'dialect_opts'})
419 19 74 if (exists $SQPCOMPAT{$key})
441 18 12 if ($self->{'field_class'} eq 'Search::Query::Field' and $self->{'query_class'}->field_class ne $self->{'field_class'})
447 25 5 if $self->{'fields'}
477 0 230 unless my $name = shift()
478 8 222 unless (exists $self->{'fields'}{$name})
513 0 25 unless (defined $origfields)
521 0 25 if (not $reftype or $reftype ne 'ARRAY' and $reftype ne 'HASH')
526 21 4 if ($reftype eq 'ARRAY') { }
4 0 elsif ($reftype eq 'HASH') { }
528 0 37 if (&blessed($name)) { }
1 36 elsif (ref $name eq 'HASH') { }
532 0 1 unless (exists $name->{'name'})
546 0 12 if (&blessed($val)) { }
12 0 elsif (ref $val eq 'HASH') { }
0 0 elsif (not ref $val) { }
550 12 0 unless (exists $val->{'name'})
579 0 8 unless $name
580 0 8 unless $field
581 0 8 unless &blessed($field)
598 0 84 unless defined $q
607 2 1 unless (defined $query or $self->sloppy)
608 1 1 if $self->croak_on_error
614 1 81 if (not defined $query and $self->sloppy)
618 3 78 if ($self->{'term_expander'})
622 68 13 if ($self->{'fields'})
629 1 77 if ($self->error and $self->sloppy)
639 27 50 if (defined $query and not $self->error and $self->croak_on_error)
644 0 27 unless (defined $reparsed)
670 7 7 if ($t =~ /^$bools$/)
681 0 2 if (not defined $query) { }
682 0 0 if $self->croak_on_error
693 0 3 if (ref $expander ne 'CODE')
702 0 3 if ($clause->is_tree)
708 0 3 if (ref $newterms[0] and ref $clause->value) { }
1 2 elsif (@newterms > 1) { }
761 0 68 unless exists $self->{'fields'}
776 46 122 if ($clause->is_tree)
780 14 16 unless (defined $clause->field and length $clause->field or defined $default_field)
787 16 92 unless ($clause->op)
798 16 92 if (not defined $clause->field) { }
800 2 14 ref $default_field ? :
812 3 107 unless (exists $fields->{$cfield})
817 10 97 if ($field_def->alias_for) { }
820 2 8 ref $field_def->alias_for ? :
832 4 101 if (@field_names > 1) { }
873 20 81 if (not defined $clause->field or $field_names[0] ne $clause->field)
891 50 126 if ($clause->is_tree) { }
895 14 112 unless defined $clause->field and length $clause->field
899 3 109 unless ($field)
900 2 1 if ($self->croak_on_error) { }
908 1 108 if (not $field->validate($field_value))
909 1 0 if ($self->croak_on_error)
964 64 291 if (/^\)/)
968 4 60 if ($self->{'_paren_count'} < 0) { }
969 1 3 if (not $fixup) { }
986 11 280 if (s/^(\+|-)\s*//) { }
5 275 elsif (s/^($not_regex)\b\s*//) { }
3 272 elsif (s/^\!\s*([^:=~])/$1/) { }
993 135 156 if (s/^"($field_regex)"\s*($op_regex)\s*// or s/^'?($field_regex)'?\s*($op_regex)\s*// or s/^()($op_nofield_regex)\s*//)
1002 0 135 if ($parent_field)
1011 31 260 if (s/^(")([^"]*?)"~(\d+)\s*// or s/^(")([^"]*?)"\s*// or s/^(')([^']*?)'\s*//) { }
1 259 elsif ($fixup and s/^(")([^"]*?)\s*$//) { }
7 252 elsif (s/^\(\s*"?($phrase_regex)"?$range_regex"?($phrase_regex)"?\s*\)\s*//) { }
63 189 elsif (s/^\(\s*//) { }
189 0 elsif (s/^($term_regex)\s*//) { }
1049 2 5 $op =~ /\!/ ? :
1051 1 6 if (index($t1, ' ') != -1 or index($t2, ' ') != -1)
1054 1 6 $has_spaces ? :
1065 0 63 unless ($r)
1070 4 59 unless (defined $str and $str =~ s/^\)\s*//)
1071 2 2 if (defined $str and $fixup) { }
1089 0 189 if ($term =~ /^($term_regex)$range_regex($term_regex)$/) { }
5 184 elsif ($null_term and $term eq $null_term) { }
1094 0 0 $op =~ /\!/ ? :
1120 2 287 if (s/^($near_regex)\s+//)
1128 2 0 if (s/^($term_regex)\s*//) { }
1143 26 263 if (s/^($and_regex)\s+//) { }
43 220 elsif (s/^($or_regex)\s+//) { }
1150 0 69 if ($pre_bool and $post_bool and $pre_bool ne $post_bool)
1162 289 0 if ($clause) { }
1163 66 223 if $sign eq '+' and $bool eq 'OR'
1164 3 286 if $sign eq '' and $bool eq 'AND'
1165 0 289 if ($sign eq '-' and $bool eq 'OR')
1172 0 0 if ($_)
1176 0 0 if ($field)
1185 3 173 if ($err)
1192 3 173 unless (defined $q)