Lines 314-320
sub sort_fields {
Link Here
|
314 |
|
314 |
|
315 |
my @record_documents = $self->marc_records_to_documents($marc_records); |
315 |
my @record_documents = $self->marc_records_to_documents($marc_records); |
316 |
|
316 |
|
317 |
Using mappings stored in databse convert C<$marc_records> to ElasticSearch documents. |
317 |
Using mappings stored in database convert C<$marc_records> to ElasticSearch documents. |
318 |
|
318 |
|
319 |
Returns array of hash references, representing ElasticSearch documents, |
319 |
Returns array of hash references, representing ElasticSearch documents, |
320 |
acceptable as body payload in C<Search::Elasticsearch> requests. |
320 |
acceptable as body payload in C<Search::Elasticsearch> requests. |
Lines 457-470
sub marc_records_to_documents {
Link Here
|
457 |
|
457 |
|
458 |
my $mapping_rules = $self->_get_marc_mapping_rules() |
458 |
my $mapping_rules = $self->_get_marc_mapping_rules() |
459 |
|
459 |
|
460 |
Generates rules from mappings stored in databse for MARC records to Elasticsearch JSON document conversion. |
460 |
Generates rules from mappings stored in database for MARC records to Elasticsearch JSON document conversion. |
461 |
|
461 |
|
462 |
Since field retrieval is slow in C<MARC::Records> (all fields are itereted through for |
462 |
Since field retrieval is slow in C<MARC::Records> (all fields are itereted through for |
463 |
each call to C<MARC::Record>->field) we create an optimized structure of mapping |
463 |
each call to C<MARC::Record>->field) we create an optimized structure of mapping |
464 |
rules keyed by MARC field tags holding all the mapping rules for that particular tag. |
464 |
rules keyed by MARC field tags holding all the mapping rules for that particular tag. |
465 |
|
465 |
|
466 |
We can then iterate through all MARC fields for each record and apply all relevant |
466 |
We can then iterate through all MARC fields for each record and apply all relevant |
467 |
rules once per fields instead of retreiving field multiple times for each mapping rule |
467 |
rules once per fields instead of retreiving fields multiple times for each mapping rule |
468 |
wich is terribly slow. |
468 |
wich is terribly slow. |
469 |
|
469 |
|
470 |
=cut |
470 |
=cut |