From 21dc76f35b54adac2fed03d0919ba08fdeec948a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 22 Jul 2024 15:53:48 +0100 Subject: [PATCH] Bug 37333: (follow-up) Update existing tests We add a level of bracket nesting. I checked with Nick that this shouldn't cause any issues in the queries and we agreed it made sense so I've gone ahead and updated the tests to reflect the change. Signed-off-by: Martin Renvoize --- .../Koha/SearchEngine/Elasticsearch/QueryBuilder.t | 8 ++++---- t/db_dependent/Koha/SearchEngine/Zebra/QueryBuilder.t | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t index 237e387cfb..cf36311dfe 100755 --- a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t +++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t @@ -819,9 +819,9 @@ subtest "Handle search filters" => sub { my ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc ) = $qb->build_query_compat( undef, undef, undef, ["search_filter:$filter_id"] ); - is( $limit,q{(available:true) AND ((cat) AND title:(bat) OR author:(rat)) AND itype:(("BK") OR ("MU"))},"Limit correctly formed"); + is( $limit,q{(available:true) AND (((cat) AND title:(bat) OR author:(rat))) AND itype:(("BK") OR ("MU"))},"Limit correctly formed"); is( $limit_cgi,"&limit=search_filter%3A$filter_id","CGI limit is not expanded"); - is( $limit_desc,q{(available:true) AND ((cat) AND title:(bat) OR author:(rat)) AND itype:(("BK") OR ("MU"))},"Limit description is correctly expanded"); + is( $limit_desc,q{(available:true) AND (((cat) AND title:(bat) OR author:(rat))) AND itype:(("BK") OR ("MU"))},"Limit description is correctly expanded"); $filter = Koha::SearchFilter->new({ name => "test", @@ -832,9 +832,9 @@ subtest "Handle search filters" => sub { ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc ) = $qb->build_query_compat( undef, undef, undef, ["search_filter:$filter_id"] ); - is( $limit,q{(subject:biography)},"Limit correctly formed for ccl type query"); + is( $limit,q{((subject:biography))},"Limit correctly formed for ccl type query"); is( $limit_cgi,"&limit=search_filter%3A$filter_id","CGI limit is not expanded"); - is( $limit_desc,q{(subject:biography)},"Limit description is correctly handled for ccl type query"); + is( $limit_desc,q{((subject:biography))},"Limit description is correctly handled for ccl type query"); }; diff --git a/t/db_dependent/Koha/SearchEngine/Zebra/QueryBuilder.t b/t/db_dependent/Koha/SearchEngine/Zebra/QueryBuilder.t index 5a8fdb8f50..df8cfce77f 100755 --- a/t/db_dependent/Koha/SearchEngine/Zebra/QueryBuilder.t +++ b/t/db_dependent/Koha/SearchEngine/Zebra/QueryBuilder.t @@ -116,9 +116,9 @@ subtest "Handle search filters" => sub { my ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc ) = $qb->build_query_compat( undef, undef, undef, ["search_filter:$filter_id"] ); - is( $limit,q{kw=(cat) AND ti=(bat) OR au=(rat) and (mc-itype,phr=BK or mc-itype,phr=MU) and (( (allrecords,AlwaysMatches='') and (not-onloan-count,st-numeric >= 1) and (lost,st-numeric=0) ))},"Limit correctly formed"); + is( $limit,q{(kw=(cat) AND ti=(bat) OR au=(rat)) and (mc-itype,phr=BK or mc-itype,phr=MU) and (( (allrecords,AlwaysMatches='') and (not-onloan-count,st-numeric >= 1) and (lost,st-numeric=0) ))},"Limit correctly formed"); is( $limit_cgi,"&limit=search_filter%3A$filter_id","CGI limit is not expanded"); - is( $limit_desc,q{kw=(cat) AND ti=(bat) OR au=(rat) and (mc-itype,phr=BK or mc-itype,phr=MU) and (( (allrecords,AlwaysMatches='') and (not-onloan-count,st-numeric >= 1) and (lost,st-numeric=0) ))},"Limit description is correctly expanded"); + is( $limit_desc,q{(kw=(cat) AND ti=(bat) OR au=(rat)) and (mc-itype,phr=BK or mc-itype,phr=MU) and (( (allrecords,AlwaysMatches='') and (not-onloan-count,st-numeric >= 1) and (lost,st-numeric=0) ))},"Limit description is correctly expanded"); $filter = Koha::SearchFilter->new({ name => "test", @@ -129,8 +129,8 @@ subtest "Handle search filters" => sub { ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc ) = $qb->build_query_compat( undef, undef, undef, ["search_filter:$filter_id"] ); - is( $limit,q{(su=biography)},"Limit correctly formed for ccl type query"); + is( $limit,q{((su=biography))},"Limit correctly formed for ccl type query"); is( $limit_cgi,"&limit=search_filter%3A$filter_id","CGI limit is not expanded"); - is( $limit_desc,q{(su=biography)},"Limit description is correctly handled for ccl type query"); + is( $limit_desc,q{((su=biography))},"Limit description is correctly handled for ccl type query"); }; -- 2.39.5