Bugzilla – Attachment 165440 Details for
Bug 36678
Include fields with non-filing characters removed when indexing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36678: Index fields with non-filing characters in both versions
Bug-36678-Index-fields-with-non-filing-characters-.patch (text/plain), 2.60 KB, created by
Nick Clemens (kidclamp)
on 2024-04-23 19:04:15 UTC
(
hide
)
Description:
Bug 36678: Index fields with non-filing characters in both versions
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-04-23 19:04:15 UTC
Size:
2.60 KB
patch
obsolete
>From 7363959653840c500e8e8b9d6c125f69e59615f0 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 23 Apr 2024 18:57:54 +0000 >Subject: [PATCH] Bug 36678: Index fields with non-filing characters in both > versions > >Currently we only remove non-filing characters for sort fields, however, this can make searching difficult. >This patch adds the filing form to the index as well to aid in searching. > >To test: > 0 - Setup Koha with Elasticsearch > 1 - Import the sample record on this report: "L'amour de l'art" > 2 - Search for "amour de l'art" - no results > 3 - Apply patch > 4 - Reindex > 5 - Search for "amour de l'art" - result! > 6 - Search for "title:amour de l'art" - result! >--- > Koha/SearchEngine/Elasticsearch.pm | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index 3f26cbc0274..c2efd562312 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -513,7 +513,13 @@ sub _process_mappings { > $nonfiling_chars = looks_like_number($nonfiling_chars) ? int($nonfiling_chars) : 0; > # Nonfiling chars does not make sense for multiple values > # Only apply on first element >- $values->[0] = substr $values->[0], $nonfiling_chars; >+ if ( $nonfiling_chars > 0 ) { >+ if ($sort) { >+ $values->[0] = substr $values->[0], $nonfiling_chars; >+ } else { >+ push @{$values}, substr $values->[0], $nonfiling_chars; >+ } >+ } > } > > $values = [ grep(!/^$/, @{$values}) ]; >@@ -1173,12 +1179,10 @@ sub _get_marc_mapping_rules { > foreach my $indicator (keys %title_fields) { > foreach my $field_tag (@{$title_fields{$indicator}}) { > my $mappings = $rules->{data_fields}->{$field_tag}->{subfields}->{a} // []; >- foreach my $mapping (@{$mappings}) { >- if ($mapping->[0] =~ /__sort$/) { >- # Mark this as to be processed for nonfiling characters indicator >- # later on in _process_mappings >- $mapping->[1]->{nonfiling_characters_indicator} = $indicator; >- } >+ foreach my $mapping ( @{$mappings} ) { >+ # Mark this as to be processed for nonfiling characters indicator >+ # later on in _process_mappings >+ $mapping->[1]->{nonfiling_characters_indicator} = $indicator; > } > } > } >-- >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 36678
:
165438
|
165439
|
165440
|
165648
|
165649
|
165960
|
165961