Bugzilla – Attachment 67098 Details for
Bug 18374
Respect QueryAutoTruncate syspref in Elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18374: QueryAutoTruncate unit tests
Bug-18374-QueryAutoTruncate-unit-tests.patch (text/plain), 2.30 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-09-12 15:17:41 UTC
(
hide
)
Description:
Bug 18374: QueryAutoTruncate unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-09-12 15:17:41 UTC
Size:
2.30 KB
patch
obsolete
>From da0dd1883bd027f518b3c7ac405168d7161aff9e Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 6 Apr 2017 14:27:50 -0400 >Subject: [PATCH] Bug 18374: QueryAutoTruncate unit tests > >To test: >1 - Apply just this patch - should fail >2 - Apply the other patch - should pass > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >index 5c37200..8afa74b 100644 >--- a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >+++ b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >@@ -81,7 +81,7 @@ subtest 'json2marc' => sub { > }; > > subtest 'build_query tests' => sub { >- plan tests => 6; >+ plan tests => 10; > > t::lib::Mocks::mock_preference('DisplayLibraryFacets','both'); > my $query = $builder->build_query(); >@@ -101,5 +101,19 @@ subtest 'build_query tests' => sub { > 'homebranch added to facets if DisplayLibraryFacets=home' ); > ok( !defined $query->{aggregations}{holdingbranch}, > 'holdingbranch not added to facets if DisplayLibraryFacets=home' ); >+ >+ t::lib::Mocks::mock_preference('QueryAutoTruncate',''); >+ ( undef, $query ) = $builder->build_query_compat( undef, ['donald duck'] ); >+ is( $query->{query}{query_string}{query}, "(donald duck)", "query not altered if QueryAutoTruncate disabled" ); >+ >+ t::lib::Mocks::mock_preference('QueryAutoTruncate','1'); >+ ( undef, $query ) = $builder->build_query_compat( undef, ['donald duck'] ); >+ is( $query->{query}{query_string}{query}, "(donald* duck*)", "simple query is auto truncated when QueryAutoTruncate enabled" ); >+ ( undef, $query ) = $builder->build_query_compat( undef, ['donald or duck and mickey not mouse'] ); >+ is( $query->{query}{query_string}{query}, "(donald* or duck* and mickey* not mouse*)", "reserved words are not affected by QueryAutoTruncate" ); #Ensure reserved words are not truncated >+ ( undef, $query ) = $builder->build_query_compat( undef, ['donald* duck*'] ); >+ is( $query->{query}{query_string}{query}, "(donald* duck*)", "query with '*' is unaltered when QueryAutoTruncate is enabled" ); >+ >+ > }; > >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18374
:
61806
|
61952
|
61953
|
61954
|
61955
|
61983
|
64903
|
64904
|
67098
|
67099
|
67100
|
67467
|
67468
|
67469
|
67470
|
67727
|
68062
|
68063
|
68064
|
68065
|
68066
|
68067
|
68068