| 1 | package Catmandu::Store::Solr::Bag; | ||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use Catmandu::Sane; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use Catmandu::Util qw(:is); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Carp qw(confess); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Catmandu::Hits; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use Catmandu::Store::Solr::Searcher; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use Catmandu::Store::Solr::CQL; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use Catmandu::Error; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use MooX::Aliases; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||
| 13 | 3 | our $VERSION = "0.0304"; | |||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||
| 15 | 3 | with 'Catmandu::Bag'; | |||||||||||||||||||||||||||||||||||
| 16 | 3 | with 'Catmandu::CQLSearchable'; | |||||||||||||||||||||||||||||||||||
| 17 | 3 | with 'Catmandu::Buffer'; | |||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||
| 19 | 3 | has cql_mapping => (is => 'ro'); | |||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||
| 21 | 3 | has bag_key => (is => 'lazy', alias => 'bag_field'); | |||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub _build_bag_key { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_build_bag_key: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||
| 24 | 0 | $_[0]->store->bag_key; | |||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub generator { | ||||||||||||||||||||||||||||||||||
|
Subroutine
generator: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 28 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||
| 29 | 0 | my $store = $self->store; | |||||||||||||||||||||||||||||||||||
| 30 | 0 | my $name = $self->name; | |||||||||||||||||||||||||||||||||||
| 31 | 0 | my $limit = $self->buffer_size; | |||||||||||||||||||||||||||||||||||
| 32 | 0 | my $bag_field = $self->bag_field; | |||||||||||||||||||||||||||||||||||
| 33 | 0 | my $query = qq/$bag_field:"$name"/; | |||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||
| 35 | 0 | state $start = 0; | |||||||||||||||||||||||||||||||||||
| 36 | 0 | state $hits; | |||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | unless ($hits && @$hits) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$hits and @$hits
MC/DC0%0/2
$hits and @$hits
$hits
@$hits
Truth table0%0/3
A and B
A= $hitsB= @$hits
| |||||||||||||||||||||||||||||||||||||
| 38 | $hits = $store->solr->search( | ||||||||||||||||||||||||||||||||||||
| 39 | $query, | ||||||||||||||||||||||||||||||||||||
| 40 | { | ||||||||||||||||||||||||||||||||||||
| 41 | start => $start, | ||||||||||||||||||||||||||||||||||||
| 42 | rows => $limit, | ||||||||||||||||||||||||||||||||||||
| 43 | defType => "lucene", | ||||||||||||||||||||||||||||||||||||
| 44 | facet => "false", | ||||||||||||||||||||||||||||||||||||
| 45 | spellcheck => "false" | ||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||
| 47 | 0 | )->content->{response}{docs}; | |||||||||||||||||||||||||||||||||||
| 48 | 0 | $start += $limit; | |||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my $hit = shift(@$hits) || return; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift @$hits || (return)
MC/DC0%0/1
shift @$hits || (return)
shift @$hits
Truth table0%0/2
A
A= shift @$hits
| |||||||||||||||||||||||||||||||||||||
| 51 | 0 | $self->map_fields($hit); | |||||||||||||||||||||||||||||||||||
| 52 | 0 | $hit; | |||||||||||||||||||||||||||||||||||
| 53 | 0 | }; | |||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub count { | ||||||||||||||||||||||||||||||||||
|
Subroutine
count: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 57 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||
| 58 | 0 | my $name = $self->name; | |||||||||||||||||||||||||||||||||||
| 59 | 0 | my $bag_field = $self->bag_field; | |||||||||||||||||||||||||||||||||||
| 60 | 0 | my $res = $self->store->solr->search( | |||||||||||||||||||||||||||||||||||
| 61 | qq/$bag_field:"$name"/, | ||||||||||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||||||||||
| 63 | rows => 0, | ||||||||||||||||||||||||||||||||||||
| 64 | facet => "false", | ||||||||||||||||||||||||||||||||||||
| 65 | spellcheck => "false", | ||||||||||||||||||||||||||||||||||||
| 66 | defType => "lucene", | ||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||||||||||
| 69 | 0 | $res->content->{response}{numFound}; | |||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||
| 72 | sub get { | ||||||||||||||||||||||||||||||||||||
| 73 | my ($self, $id) = @_; | ||||||||||||||||||||||||||||||||||||
| 74 | my $name = $self->name; | ||||||||||||||||||||||||||||||||||||
| 75 | my $id_field = $self->id_field; | ||||||||||||||||||||||||||||||||||||
| 76 | my $bag_field = $self->bag_field; | ||||||||||||||||||||||||||||||||||||
| 77 | my $res = $self->store->solr->search( | ||||||||||||||||||||||||||||||||||||
| 78 | qq/$bag_field:"$name" AND $id_field:"$id"/, | ||||||||||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||||||||||
| 80 | rows => 1, | ||||||||||||||||||||||||||||||||||||
| 81 | facet => "false", | ||||||||||||||||||||||||||||||||||||
| 82 | spellcheck => "false", | ||||||||||||||||||||||||||||||||||||
| 83 | defType => "lucene", | ||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||
| 85 | ); | ||||||||||||||||||||||||||||||||||||
| 86 | my $hit = $res->content->{response}{docs}->[0] || return; | ||||||||||||||||||||||||||||||||||||
| 87 | $self->map_fields($hit); | ||||||||||||||||||||||||||||||||||||
| 88 | $hit; | ||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||
| 91 | sub add { | ||||||||||||||||||||||||||||||||||||
| 92 | my ($self, $data) = @_; | ||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||
| 94 | my $bag_field = $self->bag_field; | ||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||
| 96 | my @fields = (WebService::Solr::Field->new($bag_field => $self->name)); | ||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||
| 98 | for my $key (keys %$data) { | ||||||||||||||||||||||||||||||||||||
| 99 | next if $key eq $bag_field; | ||||||||||||||||||||||||||||||||||||
| 100 | my $val = $data->{$key}; | ||||||||||||||||||||||||||||||||||||
| 101 | if (is_array_ref($val)) { | ||||||||||||||||||||||||||||||||||||
| 102 | is_value($_) && push @fields, | ||||||||||||||||||||||||||||||||||||
| 103 | WebService::Solr::Field->new($key => $_) | ||||||||||||||||||||||||||||||||||||
| 104 | foreach @$val; | ||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||
| 106 | elsif (is_value($val)) { | ||||||||||||||||||||||||||||||||||||
| 107 | push @fields, WebService::Solr::Field->new($key => $val); | ||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||
| 111 | $self->buffer_add(WebService::Solr::Document->new(@fields)); | ||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||
| 113 | if ($self->buffer_is_full) { | ||||||||||||||||||||||||||||||||||||
| 114 | $self->commit; | ||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||
| 118 | sub delete { | ||||||||||||||||||||||||||||||||||||
| 119 | my ($self, $id) = @_; | ||||||||||||||||||||||||||||||||||||
| 120 | my $name = $self->name; | ||||||||||||||||||||||||||||||||||||
| 121 | my $id_field = $self->id_field; | ||||||||||||||||||||||||||||||||||||
| 122 | my $bag_field = $self->bag_field; | ||||||||||||||||||||||||||||||||||||
| 123 | $self->store->solr->delete_by_query( | ||||||||||||||||||||||||||||||||||||
| 124 | qq/$bag_field:"$name" AND $id_field:"$id"/); | ||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||
| 127 | sub delete_all { | ||||||||||||||||||||||||||||||||||||
| 128 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||
| 129 | my $name = $self->name; | ||||||||||||||||||||||||||||||||||||
| 130 | my $bag_field = $self->bag_field; | ||||||||||||||||||||||||||||||||||||
| 131 | $self->store->solr->delete_by_query(qq/$bag_field:"$name"/); | ||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||
| 134 | sub delete_by_query { | ||||||||||||||||||||||||||||||||||||
| 135 | my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||
| 136 | my $name = $self->name; | ||||||||||||||||||||||||||||||||||||
| 137 | my $bag_field = $self->bag_field; | ||||||||||||||||||||||||||||||||||||
| 138 | $self->store->solr->delete_by_query( | ||||||||||||||||||||||||||||||||||||
| 139 | qq/$bag_field:"$name" AND ($args{query})/); | ||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||
| 142 | sub commit { | ||||||||||||||||||||||||||||||||||||
| 143 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||
| 144 | my $solr = $self->store->solr; | ||||||||||||||||||||||||||||||||||||
| 145 | my $err; | ||||||||||||||||||||||||||||||||||||
| 146 | if ($self->buffer_used) { | ||||||||||||||||||||||||||||||||||||
| 147 | eval {$solr->add($self->buffer)} or push @{$err ||= []}, $@; | ||||||||||||||||||||||||||||||||||||
| 148 | $self->clear_buffer; | ||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||
| 150 | unless ($self->store->{_tx}) { | ||||||||||||||||||||||||||||||||||||
| 151 | eval {$solr->commit} or push @{$err ||= []}, $@; | ||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||
| 154 | if (defined $err && $self->store->on_error eq 'throw') { | ||||||||||||||||||||||||||||||||||||
| 155 | Catmandu::Error->throw($err->[0]); | ||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||
| 159 | sub search { | ||||||||||||||||||||||||||||||||||||
| 160 | my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||
| 162 | my $query = delete $args{query}; | ||||||||||||||||||||||||||||||||||||
| 163 | my $start = delete $args{start}; | ||||||||||||||||||||||||||||||||||||
| 164 | my $limit = delete $args{limit}; | ||||||||||||||||||||||||||||||||||||
| 165 | my $bag = delete $args{reify}; | ||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||
| 167 | my $name = $self->name; | ||||||||||||||||||||||||||||||||||||
| 168 | my $id_field = $self->id_field; | ||||||||||||||||||||||||||||||||||||
| 169 | my $bag_field = $self->bag_field; | ||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||
| 171 | my $bag_fq = qq/{!type=lucene}$bag_field:"$name"/; | ||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||
| 173 | if ($args{fq}) { | ||||||||||||||||||||||||||||||||||||
| 174 | if (is_array_ref($args{fq})) { | ||||||||||||||||||||||||||||||||||||
| 175 | $args{fq} = [$bag_fq, @{$args{fq}}]; | ||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||
| 177 | else { | ||||||||||||||||||||||||||||||||||||
| 178 | $args{fq} = [$bag_fq, $args{fq}]; | ||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||
| 181 | else { | ||||||||||||||||||||||||||||||||||||
| 182 | $args{fq} = $bag_fq; | ||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||
| 185 | my $res = $self->store->solr->search($query, | ||||||||||||||||||||||||||||||||||||
| 186 | {%args, start => $start, rows => $limit}); | ||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||
| 188 | my $set = $res->content->{response}{docs}; | ||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||
| 190 | if ($bag) { | ||||||||||||||||||||||||||||||||||||
| 191 | $set = [map {$bag->get($_->{$id_field})} @$set]; | ||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||
| 193 | else { | ||||||||||||||||||||||||||||||||||||
| 194 | $self->map_fields($_) for (@$set); | ||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||
| 197 | my $hits = Catmandu::Hits->new( | ||||||||||||||||||||||||||||||||||||
| 198 | { | ||||||||||||||||||||||||||||||||||||
| 199 | limit => $limit, | ||||||||||||||||||||||||||||||||||||
| 200 | start => $start, | ||||||||||||||||||||||||||||||||||||
| 201 | total => $res->content->{response}{numFound}, | ||||||||||||||||||||||||||||||||||||
| 202 | hits => $set, | ||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||
| 204 | ); | ||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||
| 206 | if ($res->facet_counts) { | ||||||||||||||||||||||||||||||||||||
| 207 | $hits->{facets} = $res->facet_counts; | ||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||
| 210 | if ($res->spellcheck) { | ||||||||||||||||||||||||||||||||||||
| 211 | $hits->{spellcheck} = $res->spellcheck; | ||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||
| 213 | if ($res->content->{highlighting}) { | ||||||||||||||||||||||||||||||||||||
| 214 | $hits->{highlighting} = $res->content->{highlighting}; | ||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||
| 217 | $hits; | ||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||
| 220 | sub searcher { | ||||||||||||||||||||||||||||||||||||
| 221 | my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||
| 222 | Catmandu::Store::Solr::Searcher->new(%args, bag => $self); | ||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | sub translate_sru_sortkeys { | ||||||||||||||||||||||||||||||||||
|
Subroutine
translate_sru_sortkeys: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 226 | 0 | my ($self, $sortkeys) = @_; | |||||||||||||||||||||||||||||||||||
| 227 | join(',', | ||||||||||||||||||||||||||||||||||||
| 228 | 0 | grep {defined $_} map {$self->_translate_sru_sortkey($_)} split /\s+/, | |||||||||||||||||||||||||||||||||||
| 229 | $sortkeys); | ||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | sub _translate_sru_sortkey { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_translate_sru_sortkey: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||||||||||
| 233 | 0 | my ($self, $sortkey) = @_; | |||||||||||||||||||||||||||||||||||
| 234 | 0 | my ($field, $schema, $asc) = split /,/, $sortkey; | |||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | $field || return; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | if (my $map = $self->cql_mapping) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 237 | 0 | $field = lc $field; | |||||||||||||||||||||||||||||||||||
| 238 | $field =~ s/(?<=[^_])_(?=[^_])//g | ||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | if $map->{strip_separating_underscores}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | $map = $map->{indexes} || return; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$map->{'indexes'} || (return)
MC/DC0%0/1
$map->{'indexes'} || (return)
$map->{'indexes'}
Truth table0%0/2
A
A= $map->{'indexes'}
| |||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | $map = $map->{$field} || return; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$map->{$field} || (return)
MC/DC0%0/1
$map->{$field} || (return)
$map->{$field}
Truth table0%0/2
A
A= $map->{$field}
| |||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | $map->{sort} || return; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | if (ref $map->{sort} && $map->{sort}{field}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
ref $map->{"sort"} and $map->{"sort"}{"field"}
MC/DC0%0/2
ref $map->{"sort"} and $map->{"sort"}{"field"}
ref $map->{"sort"}
$map->{"sort"}{"field"}
Truth table0%0/3
A and B
A= ref $map->{"sort"}B= $map->{"sort"}{"field"}
| |||||||||||||||||||||||||||||||||||||
| 244 | 0 | $field = $map->{sort}{field}; | |||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||
| 246 | elsif (ref $map->{field}) { | ||||||||||||||||||||||||||||||||||||
| 247 | 0 | $field = $map->{field}->[0]; | |||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||
| 249 | elsif ($map->{field}) { | ||||||||||||||||||||||||||||||||||||
| 250 | 0 | $field = $map->{field}; | |||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | $asc //= 1; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$asc //= 1
MC/DC0%0/1
$asc //= 1
$asc
Truth table0%0/2
A
A= $asc
| |||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | "${field} " . ($asc ? "asc" : "desc"); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | sub translate_cql_query { | ||||||||||||||||||||||||||||||||||
|
Subroutine
translate_cql_query: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 258 | 0 | my ($self, $query) = @_; | |||||||||||||||||||||||||||||||||||
| 259 | 0 | Catmandu::Store::Solr::CQL->new(mapping => $self->cql_mapping) | |||||||||||||||||||||||||||||||||||
| 260 | ->parse($query); | ||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub normalize_query { | ||||||||||||||||||||||||||||||||||
|
Subroutine
normalize_query: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | $_[1] || "{!type=lucene}*:*"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | sub map_fields { | ||||||||||||||||||||||||||||||||||
|
Subroutine
map_fields: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 268 | 0 | my ($self, $item) = @_; | |||||||||||||||||||||||||||||||||||
| 269 | 0 | delete $item->{$self->bag_field}; | |||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||
| 272 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||
| 274 | L<Catmandu::Bag>, L<Catmandu::Searchable> | ||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||
| 276 | =cut | ||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||
| 278 | 3 | 1; | |||||||||||||||||||||||||||||||||||