App-ElasticSearch-Utilities
view release on metacpan or search on metacpan
t/01-querystring.t view on Meta::CPAN
{
'regexp' => {
'foo' => 'bar.*',
}
}
]
}
},
],
'10-phrase-filter' => [
['+foo:bar baz'],
{
'bool' => {
'must' => [
{
'match_phrase' => {
'foo' => 'bar baz',
}
}
]
}
},
],
'11-match-promotion' => [
['a_text_field:foo'],
{
'bool' => {
'must' => [
{
'match' => {
'a_text_field' => 'foo',
}
}
]
}
},
],
'12-match-not-terms' => [
['=a_text_field:foo'],
{
'bool' => {
'must' => [
{
'match' => {
'a_text_field' => 'foo',
}
}
]
}
},
],
);
my $qs = App::ElasticSearch::Utilities::QueryString->new(
fields_meta => {
a_text_field => { type => "text" },
},
);
foreach my $t (sort keys %tests) {
my $q = $qs->expand_query_string( @{ $tests{$t}->[0] } );
is_deeply( $q->query, $tests{$t}->[1], $t )
or diag( join(' ', @{ $tests{$t}->[0] }) . "\n", Dumper $q->query );
}
done_testing();
__DATA__
alice 50 1.2.3.4
bob 20 1.2.3.5
charlie 70 1.2.3.6
( run in 0.361 second using v1.01-cache-2.11-cpan-5623c5533a1 )