# I wonder if these should be real values defined in the mapping
# rather than hard-coded conversions.
- # Our results often come through as nested arrays, to fix this
- # requires changes in catmandu.
- my $authid = $record->{ 'Local-number' }[0][0];
+ # Handle legacy nested arrays indexed with splitting enabled.
+ my $authid = $record->{ 'Local-number' }[0];
+ $authid = @$authid[0] if (ref $authid eq 'ARRAY');
$result{authid} = $authid;
# TODO put all this info into the record at index time so we
# with the record. It's not documented why this is the case, so
# it's not reproduced here yet.
my $authtype = $rs->single;
- my $auth_tag_to_report = $authtype->auth_tag_to_report;
+ my $auth_tag_to_report = $authtype ? $authtype->auth_tag_to_report : "";
my $marc = $self->json2marc($marc_json);
my $mainentry = $marc->field($auth_tag_to_report);
my $reported_tag;
}
}
# Turn the resultset into a hash
- my %authtype_cols;
- foreach my $col ($authtype->result_source->columns) {
- $authtype_cols{$col} = $authtype->get_column($col);
- }
- $result{authtype} = $authtype->authtypetext;
+ $result{authtype} = $authtype ? $authtype->authtypetext : $authtypecode;
$result{reported_tag} = $reported_tag;
# Reimplementing BuildSummary is out of scope because it'll be hard
return $marc;
}
+sub max_result_window {
+ my ($self) = @_;
+
+ $self->store(
+ Catmandu::Store::ElasticSearch->new(%{ $self->get_elasticsearch_params })
+ ) unless $self->store;
+
+ my $index_name = $self->store->index_name;
+ my $settings = $self->store->es->indices->get_settings(
+ index => $index_name,
+ params => { include_defaults => 1, flat_settings => 1 },
+ );
+
+ my $max_result_window = $settings->{$index_name}->{settings}->{'index.max_result_window'};
+ $max_result_window //= $settings->{$index_name}->{defaults}->{'index.max_result_window'};
+
+ return $max_result_window;
+}
+
=head2 _convert_facets
my $koha_facets = _convert_facets($es_facets, $expanded_facet);