| 1 | package Elastic::Model::0_90::Result; | ||
| 2 | $Elastic::Model::0_90::Result::VERSION = '0.52'; | ||
| 3 | use Moose; | ||
| 4 | extends 'Elastic::Model::Result'; | ||
| 5 | |||
| 6 | use Carp; | ||
| 7 | use Elastic::Model::Types qw(UID); | ||
| 8 | use MooseX::Types::Moose qw(HashRef Maybe Num Bool); | ||
| 9 | |||
| 10 | use namespace::autoclean; | ||
| 11 | |||
| 12 | around BUILDARGS => sub { | ||
| 13 | my $orig = shift; | ||
| 14 | my $class = shift; | ||
| 15 | my $params = ref $_[0] eq 'HASH' ? shift : {@_}; | ||
| 16 | my $fields = $params->{result}{fields}; | ||
| 17 | for ( keys %$fields ) { | ||
| 18 | next if substr( $_, 0, 1 ) eq '_'; | ||
| 19 | $fields->{$_} = [ $fields->{$_} ] | ||
| 20 | unless ref $fields->{$_} eq 'ARRAY'; | ||
| 21 | } | ||
| 22 | return $class->$orig($params); | ||
| 23 | }; | ||
| 24 | |||
| 25 | 1; | ||
| 26 | |||
| 27 | =pod | ||
| 28 | |||
| 29 | =encoding UTF-8 | ||
| 30 | |||
| 31 | =head1 NAME | ||
| 32 | |||
| 33 | Elastic::Model::0_90::Result - A 0.90.x compatibility class for Elastic::Model::Result | ||
| 34 | |||
| 35 | =head1 VERSION | ||
| 36 | |||
| 37 | version 0.52 | ||
| 38 | |||
| 39 | =head1 DESCRIPTION | ||
| 40 | |||
| 41 | L<Elastic::Model::0_90::Result> converts the values in C<fields> | ||
| 42 | into arrays, in the same way that they are returned in Elasticsearch | ||
| 43 | 1.x. | ||
| 44 | |||
| 45 | See L<Elastic::Manual::Delta> for more information about enabling | ||
| 46 | the 0.90.x compatibility mode. | ||
| 47 | |||
| 48 | =head1 AUTHOR | ||
| 49 | |||
| 50 | Clinton Gormley <drtech@cpan.org> | ||
| 51 | |||
| 52 | =head1 COPYRIGHT AND LICENSE | ||
| 53 | |||
| 54 | This software is copyright (c) 2015 by Clinton Gormley. | ||
| 55 | |||
| 56 | This is free software; you can redistribute it and/or modify it under | ||
| 57 | the same terms as the Perl 5 programming language system itself. | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | __END__ |