Lines 189-197
sub get_elasticsearch_mappings {
Link Here
|
189 |
if (!defined $all_mappings{$self->index}) { |
189 |
if (!defined $all_mappings{$self->index}) { |
190 |
$sort_fields{$self->index} = {}; |
190 |
$sort_fields{$self->index} = {}; |
191 |
# Clone the general mapping to break ties with the original hash |
191 |
# Clone the general mapping to break ties with the original hash |
192 |
my $mappings = { |
192 |
my $mappings = clone(_get_elasticsearch_field_config('general', '')); |
193 |
data => clone(_get_elasticsearch_field_config('general', '')) |
|
|
194 |
}; |
195 |
my $marcflavour = lc C4::Context->preference('marcflavour'); |
193 |
my $marcflavour = lc C4::Context->preference('marcflavour'); |
196 |
$self->_foreach_mapping( |
194 |
$self->_foreach_mapping( |
197 |
sub { |
195 |
sub { |
Lines 214-238
sub get_elasticsearch_mappings {
Link Here
|
214 |
} |
212 |
} |
215 |
|
213 |
|
216 |
if ($search) { |
214 |
if ($search) { |
217 |
$mappings->{data}{properties}{$name} = _get_elasticsearch_field_config('search', $es_type); |
215 |
$mappings->{properties}{$name} = _get_elasticsearch_field_config('search', $es_type); |
218 |
} |
216 |
} |
219 |
|
217 |
|
220 |
if ($facet) { |
218 |
if ($facet) { |
221 |
$mappings->{data}{properties}{ $name . '__facet' } = _get_elasticsearch_field_config('facet', $es_type); |
219 |
$mappings->{properties}{ $name . '__facet' } = _get_elasticsearch_field_config('facet', $es_type); |
222 |
} |
220 |
} |
223 |
if ($suggestible) { |
221 |
if ($suggestible) { |
224 |
$mappings->{data}{properties}{ $name . '__suggestion' } = _get_elasticsearch_field_config('suggestible', $es_type); |
222 |
$mappings->{properties}{ $name . '__suggestion' } = _get_elasticsearch_field_config('suggestible', $es_type); |
225 |
} |
223 |
} |
226 |
# Sort is a bit special as it can be true, false, undef. |
224 |
# Sort is a bit special as it can be true, false, undef. |
227 |
# We care about "true" or "undef", |
225 |
# We care about "true" or "undef", |
228 |
# "undef" means to do the default thing, which is make it sortable. |
226 |
# "undef" means to do the default thing, which is make it sortable. |
229 |
if (!defined $sort || $sort) { |
227 |
if (!defined $sort || $sort) { |
230 |
$mappings->{data}{properties}{ $name . '__sort' } = _get_elasticsearch_field_config('sort', $es_type); |
228 |
$mappings->{properties}{ $name . '__sort' } = _get_elasticsearch_field_config('sort', $es_type); |
231 |
$sort_fields{$self->index}{$name} = 1; |
229 |
$sort_fields{$self->index}{$name} = 1; |
232 |
} |
230 |
} |
233 |
} |
231 |
} |
234 |
); |
232 |
); |
235 |
$mappings->{data}{properties}{ 'match-heading' } = _get_elasticsearch_field_config('search', 'text') if $self->index eq 'authorities'; |
233 |
$mappings->{properties}{ 'match-heading' } = _get_elasticsearch_field_config('search', 'text') if $self->index eq 'authorities'; |
236 |
$all_mappings{$self->index} = $mappings; |
234 |
$all_mappings{$self->index} = $mappings; |
237 |
} |
235 |
} |
238 |
$self->sort_fields(\%{$sort_fields{$self->index}}); |
236 |
$self->sort_fields(\%{$sort_fields{$self->index}}); |