Bugzilla – Attachment 169423 Details for
Bug 37430
(Bug 33407 follow-up) ISBD punctuation removal in ES searches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37430: (Bug 33407 follow-up) ISBD punctuation removal in ES searches
Bug-37430-Bug-33407-follow-up-ISBD-punctuation-rem.patch (text/plain), 2.39 KB, created by
Roman Dolny
on 2024-07-23 14:18:45 UTC
(
hide
)
Description:
Bug 37430: (Bug 33407 follow-up) ISBD punctuation removal in ES searches
Filename:
MIME Type:
Creator:
Roman Dolny
Created:
2024-07-23 14:18:45 UTC
Size:
2.39 KB
patch
obsolete
>From 28093b5c4f2b58db4b8de0c9eecd9d10702423b2 Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Mon, 22 Jul 2024 12:01:40 +0000 >Subject: [PATCH] Bug 37430: (Bug 33407 follow-up) ISBD punctuation removal in > ES searches > >Tiny adjustment for very special and malicious cases needed in >Koha::SearchEngine::Elasticsearch::QueryBuilder::clean_search_term. > >Extended unit tests added following Nick's suggestions in >Bug 33407 discussion. > >Test plan >========= >1. Use ktd with Elasticsearch and ktd's test data. >2. Edit the 4th record (The C programming language) and add a semicolon > followed by a space before the slash in 245 $a to have: > The C programming language ; / >3. Make a search for the first ISBD zone taken verbatim from the forth > record: > The C programming language ; / Brian W. Kernighan, Dennis M. Ritchie > > There should be no result. >4. Apply the patch, restart plack. >5. Repeat the search. You should get the record. > >Sponsored-by: Ignatianum University in Cracow >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index dea84c83a2..d6e7be3042 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -1024,8 +1024,13 @@ sub clean_search_term { > # screen all brackets with backslash > $term =~ s/(?<!\\)(?:[\\]{2})*([\{\}\[\]])$lookahead/\\$1/g; > >- # remove problematic punctuation and escaped slashes surrounded by spaces if truncate >- $term =~ s/\s+(\s*[&;,:\.=\-\/]|(\\\/)\s*)+\s$lookahead/ /g if $truncate; >+ # Remove problematic punctuation and escaped slashes surrounded by spaces if truncate. >+ # This mainly relates to ISBD punctuation. >+ # Note that slashes identified as RE limits will not be removed nor the contents of RE >+ # will be altered (cf. @saved_regexes). In other cases (i.e. escaped slashes >+ # (cf. QueryRegexEscapeOptions) and unescaped slashes not identified as being limits >+ # to a RE, i.e. the last odd unescaped slash), the slashes will be removed. >+ $term =~ s/\s([&;,:\.=\-\/\s]|(\\\/))+\s$lookahead/ /g if $truncate; > > # restore all regex contents after escaping brackets: > for (my $i = 0; $i < @saved_regexes; $i++) { >-- >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 37430
:
169408
|
169409
|
169423
|
169424
|
171606
|
171607