|
Lines 29-34
use List::Util qw( all );
Link Here
|
| 29 |
use Koha::Database; |
29 |
use Koha::Database; |
| 30 |
use Koha::SearchEngine::Elasticsearch::QueryBuilder; |
30 |
use Koha::SearchEngine::Elasticsearch::QueryBuilder; |
| 31 |
|
31 |
|
|
|
32 |
use version; |
| 33 |
|
| 32 |
my $schema = Koha::Database->new->schema; |
34 |
my $schema = Koha::Database->new->schema; |
| 33 |
$schema->storage->txn_begin; |
35 |
$schema->storage->txn_begin; |
| 34 |
|
36 |
|
|
Lines 231-236
subtest 'build_query tests' => sub {
Link Here
|
| 231 |
my %options; |
233 |
my %options; |
| 232 |
$options{sort} = \@sort_params; |
234 |
$options{sort} = \@sort_params; |
| 233 |
my $query = $qb->build_query('test', %options); |
235 |
my $query = $qb->build_query('test', %options); |
|
|
236 |
my $es_key = '_key'; |
| 237 |
$qb->get_elasticsearch(); |
| 238 |
if (version->parse($qb->{es_version}) < version->parse('6.0.0')) { |
| 239 |
$es_key = '_term'; |
| 240 |
} |
| 234 |
|
241 |
|
| 235 |
is_deeply( |
242 |
is_deeply( |
| 236 |
$query->{sort}, |
243 |
$query->{sort}, |
|
Lines 507-513
subtest 'build_query tests' => sub {
Link Here
|
| 507 |
$query->{aggregations}{'author'}{'terms'}, |
514 |
$query->{aggregations}{'author'}{'terms'}, |
| 508 |
{ |
515 |
{ |
| 509 |
field => 'author__facet', |
516 |
field => 'author__facet', |
| 510 |
order => { '_term' => 'asc' }, |
517 |
order => { $es_key => 'asc' }, |
| 511 |
include => '[nN][eE][wW].*' |
518 |
include => '[nN][eE][wW].*' |
| 512 |
}, |
519 |
}, |
| 513 |
"scan aggregation request is properly formed" |
520 |
"scan aggregation request is properly formed" |
|
Lines 525-531
subtest 'build_query tests' => sub {
Link Here
|
| 525 |
$query->{aggregations}{'subject'}{'terms'}, |
532 |
$query->{aggregations}{'subject'}{'terms'}, |
| 526 |
{ |
533 |
{ |
| 527 |
field => 'subject__facet', |
534 |
field => 'subject__facet', |
| 528 |
order => { '_term' => 'asc' }, |
535 |
order => { $es_key => 'asc' }, |
| 529 |
include => '[nN][eE][wW].*' |
536 |
include => '[nN][eE][wW].*' |
| 530 |
}, |
537 |
}, |
| 531 |
"scan aggregation request is properly formed" |
538 |
"scan aggregation request is properly formed" |
| 532 |
- |
|
|