Bugzilla – Attachment 118499 Details for
Bug 27431
ES searches containing words starting with 2 hyphens or only hyphen(s) fail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27431: Elasticsearch - escape words that equal to hyphen or starting with more than one hyphen
Bug-27431-Elasticsearch---escape-words-that-equal-.patch (text/plain), 1.03 KB, created by
PTFS Europe Sandboxes
on 2021-03-19 09:24:52 UTC
(
hide
)
Description:
Bug 27431: Elasticsearch - escape words that equal to hyphen or starting with more than one hyphen
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2021-03-19 09:24:52 UTC
Size:
1.03 KB
patch
obsolete
>From d9a5b6d3aab2a4b2b9b3c5d3d0492c7aaa80a031 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Thu, 14 Jan 2021 13:16:30 +0000 >Subject: [PATCH] Bug 27431: Elasticsearch - escape words that equal to hyphen > or starting with more than one hyphen > >Signed-off-by: HUGO AGUD <hagud@orex.es> >--- > 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 eed466049b..c580c13b88 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -983,6 +983,11 @@ sub _query_regex_escape_process { > $query =~ s@(?:(?<!\\)(?:((?:[\\]{2})*[\\])|((?:[\\]{2})*))(?=/))(?![^"]*"(?:[^"]*"[^"]*")*[^"]*$)@($1 ? substr($1, 0, -1) : ($2 . "\\"))@ge; > } > } >+ >+ # Always escape string starting with double hyphen or hyphen alone >+ $query =~ s@^--@\\--@; >+ $query =~ s@^-$@\\-@; >+ > return $query; > } > >-- >2.11.0
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 27431
:
115156
| 118499