Bugzilla – Attachment 104942 Details for
Bug 25277
Z3950responder keyword search does not work with Elasticsearch 6
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25277: Don't specify a field in query if none passed
Bug-25277-Dont-specify-a-field-in-query-if-none-pa.patch (text/plain), 3.04 KB, created by
Jonathan Druart
on 2020-05-15 13:17:42 UTC
(
hide
)
Description:
Bug 25277: Don't specify a field in query if none passed
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-05-15 13:17:42 UTC
Size:
3.04 KB
patch
obsolete
>From 24cd36fce4b92c0d0b09151604956b0b77947ade Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 24 Apr 2020 13:34:31 +0000 >Subject: [PATCH] Bug 25277: Don't specify a field in query if none passed > >== test plan == >To test: >0 - Have Koha running with ES 6 enabled >1 - Launch the z3950 responder: > perl misc/z3950_responder.pl --config-dir /kohadevbox/koha/etc/z3950 --debug >2 - Connect using yaz-client: > yaz-client localhost:2100 >2.1 Alternative, if you add the responder as a Z39.50 server in Koha and > do a catalogue Z39.50 search. Don't forget to search in the keywords > field. Not the title field. >3 - base biblios >4 - find bruce >5 - No results >6 - Stop the responder >7 - Apply patch >8 - Repeat >9 - This time you get results > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Amended patch: Removed unecessary () in the return statement >--- > Koha/Z3950Responder/RPN.pm | 13 +++++++++---- > etc/z3950/attribute_mappings.yaml | 2 -- > 2 files changed, 9 insertions(+), 6 deletions(-) > >diff --git a/Koha/Z3950Responder/RPN.pm b/Koha/Z3950Responder/RPN.pm >index 63fbbdd83d..cdc43a723e 100644 >--- a/Koha/Z3950Responder/RPN.pm >+++ b/Koha/Z3950Responder/RPN.pm >@@ -40,7 +40,7 @@ sub to_koha { > my ($self, $mappings) = @_; > > my $attrs = $self->{'attributes'}; >- my $fields = $mappings->{use}{default} // '_all'; >+ my $fields = $mappings->{use}{default}; > my $split = 0; > my $prefix = ''; > my $suffix = ''; >@@ -62,7 +62,7 @@ sub to_koha { > } > } > >- $fields = [$fields] unless ref($fields) eq 'ARRAY'; >+ $fields = [$fields] unless !defined $fields || ref($fields) eq 'ARRAY'; > > if ($split) { > my @terms; >@@ -72,8 +72,12 @@ sub to_koha { > next if (!$word); > $word = $self->escape($word); > my @words; >- foreach my $field (@{$fields}) { >- push(@words, "$field:($prefix$word$suffix)"); >+ if( $fields ) { >+ foreach my $field (@{$fields}) { >+ push(@words, "$field:($prefix$word$suffix)"); >+ } >+ } else { >+ push(@words, "($prefix$word$suffix)"); > } > push (@terms, join(' OR ', @words)); > } >@@ -82,6 +86,7 @@ sub to_koha { > > my @terms; > $term = $self->escape($term); >+ return "($prefix$term$suffix)" unless $fields; > foreach my $field (@{$fields}) { > push(@terms, "$field:($prefix$term$suffix)"); > } >diff --git a/etc/z3950/attribute_mappings.yaml b/etc/z3950/attribute_mappings.yaml >index 21d7e8f3f6..c4923fc532 100644 >--- a/etc/z3950/attribute_mappings.yaml >+++ b/etc/z3950/attribute_mappings.yaml >@@ -8,7 +8,6 @@ authorities: > 3: Heading > 9: LC-card-number > 12: Local-number >- default: _all > biblios: > # BIB-1 use attributes to index fields > use: >@@ -43,4 +42,3 @@ biblios: > 1031: itype > 1033: Host-Item-Number > 1045: control-number >- default: _all >-- >2.20.1
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 25277
:
103690
|
103698
|
104293
|
104294
| 104942 |
104943