Bugzilla – Attachment 174486 Details for
Bug 30745
Elasticsearch: Search never returns with after-date and/or before-date in label batch item search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30745: Use query builder and search_compat in label-item-search
Bug-30745-Use-query-builder-and-searchcompat-in-la.patch (text/plain), 3.05 KB, created by
David Cook
on 2024-11-14 05:58:16 UTC
(
hide
)
Description:
Bug 30745: Use query builder and search_compat in label-item-search
Filename:
MIME Type:
Creator:
David Cook
Created:
2024-11-14 05:58:16 UTC
Size:
3.05 KB
patch
obsolete
>From f17a2ddf66f78c1df3ed6481a0f25690a8cfc66f Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Thu, 12 May 2022 11:56:04 +0200 >Subject: [PATCH] Bug 30745: Use query builder and search_compat in > label-item-search > >Test plan: > - apply this patch, > - make some searches in labels/label-item-search.pl using > the 3 form input (index, after date, before date), > - check it works like before > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >https://bugs.koha-community.org/show_bug.cgi?id=30845 >Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> >Signed-off-by: David Cook <dcook@prosentient.com.au> >--- > labels/label-item-search.pl | 31 ++++++++++++++++++++----------- > 1 file changed, 20 insertions(+), 11 deletions(-) > >diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl >index 4dba30276d..d0624e4e2d 100755 >--- a/labels/label-item-search.pl >+++ b/labels/label-item-search.pl >@@ -58,29 +58,38 @@ my $display_columns = [ {_add => {label => "Add Item", link_fi > if ( $op eq "do_search" ) { > $idx = $query->param('idx'); > $ccl_textbox = $query->param('ccl_textbox'); >- if ( $ccl_textbox && $idx ) { >- $ccl_query = "$idx:$ccl_textbox"; >- } > > $datefrom = $query->param('datefrom'); > $dateto = $query->param('dateto'); > >+ my $builder = Koha::SearchEngine::QueryBuilder->new( >+ { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); >+ my $searcher = Koha::SearchEngine::Search->new( >+ { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); >+ >+ my @limits; > if ($datefrom) { >- $ccl_query .= ' AND ' if $ccl_textbox; >- $ccl_query .= "acqdate,ge,st-date-normalized=" . $datefrom; >+ push(@limits, "acqdate,ge,st-date-normalized=$datefrom"); > } > > if ($dateto) { >- $ccl_query .= ' AND ' if ( $ccl_textbox || $datefrom ); >- $ccl_query .= "acqdate,le,st-date-normalized=" . $dateto; >+ push(@limits, "acqdate,le,st-date-normalized=$dateto"); > } > >+ my ( $error, $query, $simple_query, $query_cgi, >+ $query_desc, $limit, $limit_cgi, $limit_desc, >+ $query_type ) >+ = $builder->build_query_compat( undef, [$ccl_textbox], [$idx], \@limits); >+ > my $offset = $startfrom > 1 ? $startfrom - 1 : 0; >- my $searcher = Koha::SearchEngine::Search->new({index => 'biblios'}); >- ( $error, $marcresults, $total_hits ) = $searcher->simple_search_compat($ccl_query, $offset, $resultsperpage); > >- if (!defined $error && @{$marcresults} ) { >- $show_results = @{$marcresults}; >+ my ( $error, $marcresults, $facets ) = $searcher->search_compat( >+ $query, $simple_query, undef, ['biblioserver'], $resultsperpage, $offset, >+ undef, undef, $query_type, undef >+ ); >+ >+ if (!defined $error && $marcresults->{biblioserver}{RECORDS} ) { >+ $show_results = $marcresults->{biblioserver}{RECORDS}; > } > else { > Koha::Logger->get->warn("ERROR label-item-search: no results from simple_search_compat"); >-- >2.39.5
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 30745
:
134952
|
134953
|
135784
|
135785
|
135966
|
135967
|
157192
|
157194
|
157195
|
157934
|
162855
|
163955
|
170677
|
170678
|
170679
|
170680
|
170681
|
170682
|
170683
|
170684
|
170729
|
170730
|
170731
|
170732
|
170733
|
171002
|
171003
|
171004
|
171005
|
171006
|
173280
|
173943
|
173944
|
173945
|
173946
|
173947
| 174486 |
174487
|
174488
|
174489
|
174490
|
174491