View | Details | Raw Unified | Return to bug 21032
Collapse All | Expand All

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-1 / +1 lines)
Lines 238-244 sub build_query_compat { Link Here
238
    #die Dumper($query);
238
    #die Dumper($query);
239
    # We roughly emulate the CGI parameters of the zebra query builder
239
    # We roughly emulate the CGI parameters of the zebra query builder
240
    my $query_cgi;
240
    my $query_cgi;
241
    $query_cgi = 'idx=kw&q=' . uri_escape_utf8( $operands->[0] ) if @$operands;
241
    $query_cgi = 'q=' . uri_escape_utf8( $operands->[0] ) if @$operands;
242
    my $simple_query;
242
    my $simple_query;
243
    $simple_query = $operands->[0] if @$operands == 1;
243
    $simple_query = $operands->[0] if @$operands == 1;
244
    my $query_desc   = $simple_query;
244
    my $query_desc   = $simple_query;
(-)a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t (-3 / +4 lines)
Lines 81-87 subtest 'json2marc' => sub { Link Here
81
};
81
};
82
82
83
subtest 'build_query tests' => sub {
83
subtest 'build_query tests' => sub {
84
    plan tests => 23;
84
    plan tests => 24;
85
85
86
    t::lib::Mocks::mock_preference('DisplayLibraryFacets','both');
86
    t::lib::Mocks::mock_preference('DisplayLibraryFacets','both');
87
    my $query = $builder->build_query();
87
    my $query = $builder->build_query();
Lines 221-232 subtest 'build_query tests' => sub { Link Here
221
        "query of specific field is added AND suppress:0"
221
        "query of specific field is added AND suppress:0"
222
    );
222
    );
223
223
224
    ( undef, $query ) = $builder->build_query_compat( undef, ['title:"donald duck"'], undef, undef, undef, undef, undef, { suppress => 0 } );
224
    my ($simple_query, $query_cgi);
225
    ( undef, $query, $simple_query, $query_cgi ) = $builder->build_query_compat( undef, ['title:"donald duck"'], undef, undef, undef, undef, undef, { suppress => 0 } );
225
    is(
226
    is(
226
        $query->{query}{query_string}{query},
227
        $query->{query}{query_string}{query},
227
        '(title:"donald duck")',
228
        '(title:"donald duck")',
228
        "query of specific field is not added AND suppress:0"
229
        "query of specific field is not added AND suppress:0"
229
    );
230
    );
231
    is($query_cgi, 'q=title%3A%22donald%20duck%22', 'query cgi');
230
};
232
};
231
233
232
subtest "_convert_sort_fields" => sub {
234
subtest "_convert_sort_fields" => sub {
233
- 

Return to bug 21032