Bugzilla – Attachment 147519 Details for
Bug 33093
(Bug 27546 follow-up) With ES searching within results does not work for 'Keyword' and 'Keyword as phrase'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33093 - (Bug 27546 follow-up) With ES searching within results does not work for 'Keyword' and 'Keyword as phrase'
Bug-33093-Bug-27546-follow-up-With-ES-searching-with.patch (text/plain), 2.32 KB, created by
Janusz Kaczmarek
on 2023-02-28 19:29:00 UTC
(
hide
)
Description:
Bug 33093 - (Bug 27546 follow-up) With ES searching within results does not work for 'Keyword' and 'Keyword as phrase'
Filename:
MIME Type:
Creator:
Janusz Kaczmarek
Created:
2023-02-28 19:29:00 UTC
Size:
2.32 KB
patch
obsolete
>From f4bb025a8a281447113b49ac44a77776ab0b4ccb Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Tue, 28 Feb 2023 19:18:05 +0100 >Subject: [PATCH] Bug 33093 - (Bug 27546 follow-up) With ES searching within > results does not work for 'Keyword' and 'Keyword as phrase' > >The feature of searching within search results in librarian >has some problems with with elastic: 'Keyword' and 'Keyword >as phrase' searches give no results. This is because elastic >is unaware of the search field 'kw' and 'kw' is not >transformed nor removed for limits. > >Test plan >========= >1. Have a Koha instance with reasonable number of biblio records >1. Set SearchEngine to Elasticsearch >3. In librarian interface, perform a search that would give > you a list of results >4. With the new search box 'Search within results', having 'Keyword' > and 'Keyword as phrase' active, try to perform a search within > search results with a term that should give you some results >5. You should get no results >6. Apply the patch >7. Repeat steps 3 and 4 >8. You should get expected results. Note the difference between > 'Keyword' and 'Keyword as phrase' in results >9. Sign off >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 10 ++++++++++ > 1 file changed, 10 insertions(+) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index 53042b4303..660082d97c 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -272,6 +272,7 @@ sub build_query_compat { > $lang, $params ) > = @_; > >+ > my $query; > my $query_str = ''; > my $search_param_query_str = ''; >@@ -1119,6 +1120,15 @@ sub _fix_limit_special_cases { > elsif ( $l =~ /^available$/ ) { > push @new_lim, 'available:true'; > } >+ elsif ( $l =~ /^\s*(kw\b[\w,-]*?):(.*)/) { >+ my ( $field, $term ) = ($1, $2); >+ if ( defined($field) && defined($term) && $field =~ /,phr$/) { >+ push @new_lim, "(\"$term\")"; >+ } >+ else { >+ push @new_lim, $term; >+ } >+ } > else { > my ( $field, $term ) = $l =~ /^\s*([\w,-]*?):(.*)/; > $field =~ s/,phr$//; #We are quoting all the limits as phrase, this prevents from quoting again later >-- >2.30.2 >
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 33093
:
147519
|
147520
|
149021
|
149771