Lines 534-541
sub _process_mappings {
Link Here
|
534 |
|
534 |
|
535 |
$values = [ grep(!/^$/, @{$values}) ]; |
535 |
$values = [ grep(!/^$/, @{$values}) ]; |
536 |
|
536 |
|
|
|
537 |
# 4 bytes is the max size of a UTF-8 char. |
538 |
# 32766 bytes is the max size of the data ES can add to an index |
539 |
# 32766 / 4 =~ 8191 |
540 |
my $MAX_SIZE = 8191; |
541 |
|
542 |
my @chunks; |
543 |
|
544 |
foreach my $value ( @{$values} ) { |
545 |
while ( length($value) > $MAX_SIZE ) { |
546 |
|
547 |
# Match up to MAX_SIZE characters, stopping at the last full word before MAX_SIZE |
548 |
if ( $value =~ /\G(.{1,$MAX_SIZE})(?:\s|$)/g ) { |
549 |
push @chunks, $1; |
550 |
$value = substr( $value, length($1) ); |
551 |
} else { |
552 |
|
553 |
# Catch-all for very long words |
554 |
push @chunks, substr( $value, 0, $MAX_SIZE ); |
555 |
$value = substr( $value, $MAX_SIZE ); |
556 |
} |
557 |
} |
558 |
push @chunks, $value if length($value); |
559 |
} |
560 |
|
537 |
$record_document->{$target} //= []; |
561 |
$record_document->{$target} //= []; |
538 |
push @{$record_document->{$target}}, @{$values}; |
562 |
push @{ $record_document->{$target} }, @chunks; |
539 |
} |
563 |
} |
540 |
} |
564 |
} |
541 |
|
565 |
|
542 |
- |
|
|