|
Lines 202-222
sub get_elasticsearch_mappings {
Link Here
|
| 202 |
# TODO be aware of date formats, but this requires pre-parsing |
202 |
# TODO be aware of date formats, but this requires pre-parsing |
| 203 |
# as ES will simply reject anything with an invalid date. |
203 |
# as ES will simply reject anything with an invalid date. |
| 204 |
my $es_type = 'text'; |
204 |
my $es_type = 'text'; |
| 205 |
if ($type eq 'boolean') { |
205 |
if ( $type eq 'boolean' ) { |
| 206 |
$es_type = 'boolean'; |
206 |
$es_type = 'boolean'; |
| 207 |
} elsif ($type eq 'number' || $type eq 'sum') { |
207 |
} elsif ( $type eq 'number' || $type eq 'sum' ) { |
| 208 |
$es_type = 'integer'; |
208 |
$es_type = 'integer'; |
| 209 |
} elsif ($type eq 'isbn' || $type eq 'stdno') { |
209 |
} elsif ( $type eq 'isbn' || $type eq 'stdno' ) { |
| 210 |
$es_type = 'stdno'; |
210 |
$es_type = 'stdno'; |
| 211 |
} elsif ($type eq 'year') { |
211 |
} elsif ( $type eq 'year' ) { |
| 212 |
$es_type = 'year'; |
212 |
$es_type = 'year'; |
| 213 |
} elsif ($type eq 'callnumber') { |
213 |
} elsif ( $type eq 'callnumber' ) { |
| 214 |
$es_type = 'cn_sort'; |
214 |
$es_type = 'cn_sort'; |
| 215 |
} elsif ($type eq 'geo_point') { |
215 |
} elsif ( $type eq 'geo_point' ) { |
| 216 |
$es_type = 'geo_point'; |
216 |
$es_type = 'geo_point'; |
| 217 |
} |
217 |
} |
| 218 |
|
218 |
|
| 219 |
if ($type eq 'geo_point') { |
219 |
if ( $type eq 'geo_point' ) { |
| 220 |
$name =~ s/_(lat|lon)$//; |
220 |
$name =~ s/_(lat|lon)$//; |
| 221 |
} |
221 |
} |
| 222 |
|
222 |
|
|
Lines 741-753
sub marc_records_to_documents {
Link Here
|
| 741 |
} |
741 |
} |
| 742 |
} |
742 |
} |
| 743 |
|
743 |
|
| 744 |
foreach my $field (@{$rules->{geo_point}}) { |
744 |
foreach my $field ( @{ $rules->{geo_point} } ) { |
| 745 |
next unless $record_document->{$field}; |
745 |
next unless $record_document->{$field}; |
| 746 |
my $geofield = $field; |
746 |
my $geofield = $field; |
| 747 |
$geofield =~ s/_(lat|lon)$//; |
747 |
$geofield =~ s/_(lat|lon)$//; |
| 748 |
my $axis = $1; |
748 |
my $axis = $1; |
| 749 |
my $vals = $record_document->{$field}; |
749 |
my $vals = $record_document->{$field}; |
| 750 |
for my $i (0 .. @$vals - 1) { |
750 |
for my $i ( 0 .. @$vals - 1 ) { |
| 751 |
my $val = $record_document->{$field}[$i]; |
751 |
my $val = $record_document->{$field}[$i]; |
| 752 |
$record_document->{$geofield}[$i]{$axis} = $val; |
752 |
$record_document->{$geofield}[$i]{$axis} = $val; |
| 753 |
} |
753 |
} |