Bugzilla – Attachment 166829 Details for
Bug 36798
Add ability to search across all ISBNs using the ISBN-search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36798: Add ability to search across all ISBNs using the ISBN-search
Bug-36798-Add-ability-to-search-across-all-ISBNs-u.patch (text/plain), 3.42 KB, created by
Janusz Kaczmarek
on 2024-05-16 14:01:29 UTC
(
hide
)
Description:
Bug 36798: Add ability to search across all ISBNs using the ISBN-search
Filename:
MIME Type:
Creator:
Janusz Kaczmarek
Created:
2024-05-16 14:01:29 UTC
Size:
3.42 KB
patch
obsolete
>From a2e2e0aacfa42a551ea3aeb42cdc5c7f12523418 Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Thu, 16 May 2024 11:29:04 +0000 >Subject: [PATCH] Bug 36798: Add ability to search across all ISBNs using the > ISBN-search > >With the Bug 36574 we added a new ES search field isbn-all which makes it >possible to find records with the content of the subfield 020 $z >(invalid/cancelled ISBN) in general search (by keyword). But still, when >performing a search with ISBN-search these records will not be found. >Since some libraries deliberately want to find records with only 020 $a >with ISBN-search, a system preference would be needed here to be able to >customize the ISBN search. > >The same for ISSNs, with one system preference. > >Test plan: >========== >(ISBN) >------ >1. Have the ktd with with ES enabled. >2. With standard ktd test data, try to perform a ISBN search from Advanced > search for 9780141930848. You should get no results. > In the general search input field (on the main page) try a search > nb:9780141930848 and/or isbn:9780141930848 - you should get no results. >3. Apply the patch, restart_all. >4. Repeat p. 2 -- you should still get no results. >5. Enable SearchCancelAndInvalidISBNandISSN syspref. >6. Repeat p. 2 -- now you should get one record (having 9780141930848 > in 020 $z). > >(ISSN) >------ >0. Return to main, delete the bug branch, reset_all == start from fresh. >1. Have the ktd with with ES enabled. >2. With standard ktd test data, try to perform a ISSN search from Advanced > search for 1089-6891. You should get no results. > In the general search input field (on the main page) try a search > ns:1089-6891 and/or issn:1089-6891 - you should get no results. >3. Apply the patch, restart_all. > If you have had to apply also the bug 36727, reindex ES with: > koha-elasticsearch --rebuild -r -d kohadev > (there is a modification of mappings.yaml) >4. Repeat p. 2 -- you should still get no results. >5. Enable SearchCancelAndInvalidISBNandISSN syspref. >6. Repeat p. 2 -- now you should get one record (having 1089-6891 > in 022 $y). > >Sponsored-by: Ignatianum University in Cracow >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index ac161e50fd..48830c24b7 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -751,6 +751,8 @@ sub _convert_index_fields { > field => exists $index_field_convert{$f} ? $index_field_convert{$f} : $f, > type => $index_type_convert{ $t // '__default' } > }; >+ $r->{field} .= '-all' >+ if C4::Context->preference('SearchCancelAndInvalidISBNandISSN') && $r->{field} =~ /^is[bs]n$/; > $r->{field} = ($mc . $r->{field}) if $mc && $r->{field}; > $r->{field} || $r->{type} ? $r : undef; > } @indexes; >@@ -818,6 +820,9 @@ sub _convert_index_strings_freeform { > $search =~ s/($field_name_pattern)(?:,[\w-]*)?($multi_field_pattern):/\L$1\E$2:/og; > # Resolve possible field aliases > $search =~ s/($field_name_pattern)($multi_field_pattern):/(exists $index_field_convert{$1} ? $index_field_convert{$1} : $1).($1 eq 'kw' ? "$2" : "$2:")/oge; >+ if ( C4::Context->preference('SearchCancelAndInvalidISBNandISSN') ) { >+ $search =~ s/\b(is[bs]n)(?=$multi_field_pattern:)/$1-all/g; >+ } > return $search; > } > >-- >2.39.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 36798
:
166828
|
166829
|
166830
|
166836
|
166837
|
166838
|
171906
|
171907
|
171908
|
171935
|
171936
|
171937