Bugzilla – Attachment 85030 Details for
Bug 19575
Use canonical field names and resolve aliased fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19575: Rebase and fix tests
Bug-19575-Rebase-and-fix-tests.patch (text/plain), 3.76 KB, created by
Nick Clemens
on 2019-02-12 21:54:57 UTC
(
hide
)
Description:
Bug 19575: Rebase and fix tests
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2019-02-12 21:54:57 UTC
Size:
3.76 KB
patch
obsolete
>From f2662499709c8edb2b5af091d3acaa15bd509ac3 Mon Sep 17 00:00:00 2001 >From: root <root@f1ebe1bec408> >Date: Tue, 12 Feb 2019 21:52:39 +0000 >Subject: [PATCH] Bug 19575: Rebase and fix tests > >This patch lower cases the sort by fields to normalize checking them and adjusts >some existing tests to meet the new expectations. > >The regex for splitting terms has been moved into a subroutine so that adjustment was made >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 7 ++++--- > t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t | 8 ++++---- > 2 files changed, 8 insertions(+), 7 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index e2e4beadeb..11ad3807a8 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -432,6 +432,7 @@ sub build_authorities_query_compat { > > # Convert to lower case > $marclist = [map(lc, @{$marclist})]; >+ $orderby = lc $orderby; > > # Make sure everything exists > foreach my $m (@$marclist) { >@@ -454,7 +455,7 @@ sub build_authorities_query_compat { > : ( $orderby =~ /^auth/ ) ? 'local-number' > : undef; > if ($sort_field) { >- my $sort_order = ( $orderby =~ /Asc$/ ) ? 'asc' : 'desc'; >+ my $sort_order = ( $orderby =~ /asc$/ ) ? 'asc' : 'desc'; > %sort = ( $sort_field => $sort_order, ); > } > my %search = ( >@@ -887,7 +888,6 @@ operands and double quoted strings. > > =cut > >-my $tokenize_split_re = qr/((?:${field_name_pattern}${multi_field_pattern}:)?"[^"]+"|\s+)/; > sub _truncate_terms { > my ( $self, $query ) = @_; > >@@ -919,7 +919,8 @@ sub _split_query { > > # '"donald duck" title:"the mouse" and peter" get split into > # ['', '"donald duck"', '', ' ', '', 'title:"the mouse"', '', ' ', 'and', ' ', 'pete'] >- my @tokens = split /((?:[\w\-.]+:)?"[^"]+"|\s+)/, $query; >+ my $tokenize_split_re = qr/((?:${field_name_pattern}${multi_field_pattern}:)?"[^"]+"|\s+)/; >+ my @tokens = split $tokenize_split_re, $query; > > # Filter out empty values > @tokens = grep( /\S/, @tokens ); >diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >index eaaebf25c2..f3e7117a80 100644 >--- a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >+++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >@@ -144,7 +144,7 @@ subtest 'build_authorities_query_compat() tests' => sub { > $query->{sort}, > [ > { >- 'Heading__sort.phrase' => 'asc' >+ 'heading__sort' => 'asc' > } > ], > "ascending sort parameter properly formed" >@@ -154,7 +154,7 @@ subtest 'build_authorities_query_compat() tests' => sub { > $query->{sort}, > [ > { >- 'Heading__sort.phrase' => 'desc' >+ 'heading__sort' => 'desc' > } > ], > "descending sort parameter properly formed" >@@ -428,7 +428,7 @@ subtest "_convert_sort_fields() tests" => sub { > is_deeply( > \@sort_by, > [ >- { field => 'callnum', direction => 'asc' }, >+ { field => 'local-classification', direction => 'asc' }, > { field => 'author', direction => 'desc' } > ], > 'sort fields should have been split correctly' >@@ -439,7 +439,7 @@ subtest "_convert_sort_fields() tests" => sub { > is_deeply( > \@sort_by, > [ >- { field => 'callnum', direction => 'asc' }, >+ { field => 'local-classification', direction => 'asc' }, > { field => 'author', direction => 'desc' } > ], > 'sort fields should have been split correctly' >-- >2.11.0
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 19575
:
68914
|
69140
|
69153
|
69306
|
69314
|
69479
|
69480
|
69507
|
70494
|
70495
|
70558
|
71090
|
71112
|
71966
|
72673
|
75115
|
81297
|
81299
|
81303
|
81304
|
82794
|
83704
|
83710
|
85029
|
85030
|
85062
|
85105
|
85124
|
85125
|
85126
|
85127
|
85128
|
85178
|
85247