| 1 | package App::ElasticSearch::Utilities::QueryString::Underscored; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Extend some _<type>_ queries | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use v5.16; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = '9.1'; # VERSION | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use CLI::Helpers qw(:output); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | with 'App::ElasticSearch::Utilities::QueryString::Plugin'; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | sub _build_priority { 20; } | ||||||||||||||||||||||||||
|
Subroutine
_build_priority: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | my %Underscored = ( | ||||||||||||||||||||||||||||
| 18 | 2 | ▶ | _prefix_ => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||
| 19 | 2 | my ($v) = @_; | |||||||||||||||||||||||||||
| 20 | 2 | my ($field,$text) = split /[:=]/, $v, 2; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 2 | ▶ | return unless defined $text and length $text; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $text and length $text
MC/DC0%0/2
defined $text and length $text
defined $text
length $text
Truth table33%1/3
A and B
A= defined $textB= length $text
| |||||||||||||||||||||||||||||
| 23 | 2 | return { condition => { prefix => { $field => $text } } } | |||||||||||||||||||||||||||
| 24 | }, | ||||||||||||||||||||||||||||
| 25 | 1 | ); | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 7 | ▶ | sub handle_token { | ||||||||||||||||||||||||||
|
Subroutine
handle_token: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 7 | my ($self,$token) = @_; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 7 | debug(sprintf "%s - evaluating token '%s'", $self->name, $token); | |||||||||||||||||||||||||||
| 32 | 7 | my ($k,$v) = split /:/, $token, 2; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 7 | ▶ | return unless exists $Underscored{lc $k} and defined $v; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $Underscored{lc $k} and defined $v
MC/DC50%1/2
exists $Underscored{lc $k} and defined $v
exists $Underscored{lc $k}
defined $v
Truth table66%2/3
A and B
A= exists $Underscored{lc $k}B= defined $v
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 2 | return $Underscored{lc $k}->($v); | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | # Return True; | ||||||||||||||||||||||||||||
| 40 | 1 | 1; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||||||||||