Bugzilla – Attachment 123138 Details for
Bug 22801
Advance search yr uses copydate instead of date-of-publication
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22801: Advance search yr must use date-of-publication and not copydate
Bug-22801-Advance-search-yr-must-use-date-of-publi.patch (text/plain), 2.74 KB, created by
Kyle M Hall (khall)
on 2021-07-23 15:06:17 UTC
(
hide
)
Description:
Bug 22801: Advance search yr must use date-of-publication and not copydate
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-07-23 15:06:17 UTC
Size:
2.74 KB
patch
obsolete
>From 11041bfbbbab1a9328697df307b96f183fe9f60c Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Fri, 22 Jan 2021 09:39:33 +0100 >Subject: [PATCH] Bug 22801: Advance search yr must use date-of-publication and > not copydate > >In advanced search with Elasticsearch the limit on years range is actually using copydate : > >Koha/SearchEngine/Elasticsearch/QueryBuilder.pm in _fix_limit_special_cases() : > if ( $l =~ /^yr,st-numeric,ge=/ ) { > my ( $start, $end ) = > ( $l =~ /^yr,st-numeric,ge=(.*) and yr,st-numeric,le=(.*)$/ ); > next unless defined($start) && defined($end); > push @new_lim, "copydate:[$start TO $end]"; > } > >With Zebra it uses date-of-publication and also in Koha/SearchEngine/Elasticsearch/QueryBuilder.pm : > >our %index_field_convert = ( >(...) > 'yr' => 'date-of-publication', > >This patch uses %index_field_convert to perform 'yr' limit. > >Test plan: >1) Apply patch >2) Use Elasticsearch searchengine >3) Go to advanced search with 'More options' >4) Perform a search with a year limit (value or range) >5) Check results are correct > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index 45e8c1f2c2..56a3997ad9 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -994,6 +994,9 @@ The argument should be an arrayref, and it'll return an arrayref. > sub _fix_limit_special_cases { > my ( $self, $limits ) = @_; > >+ # yr is usually an alias of a search field >+ my $yrfield = ( exists $index_field_convert{'yr'} ) ? $index_field_convert{'yr'} : 'yr'; >+ > my @new_lim; > foreach my $l (@$limits) { > >@@ -1002,13 +1005,13 @@ sub _fix_limit_special_cases { > my ( $start, $end ) = > ( $l =~ /^yr,st-numeric,ge=(.*) and yr,st-numeric,le=(.*)$/ ); > next unless defined($start) && defined($end); >- push @new_lim, "copydate:[$start TO $end]"; >+ push @new_lim, "$yrfield:[$start TO $end]"; > } > elsif ( $l =~ /^yr,st-numeric=/ ) { > my ($date) = ( $l =~ /^yr,st-numeric=(.*)$/ ); > next unless defined($date); > $date = $self->_modify_string_by_type(type => 'st-year', operand => $date); >- push @new_lim, "copydate:$date"; >+ push @new_lim, "$yrfield:$date"; > } > elsif ( $l =~ /^available$/ ) { > push @new_lim, 'onloan:false'; >-- >2.30.1 (Apple Git-130)
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 22801
:
115666
|
122064
|
122065
|
122066
|
122069
|
122070
| 123138 |
123139