Bugzilla – Attachment 115156 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), 1011 bytes, created by
Alex Arnaud
on 2021-01-14 13:16:57 UTC
(
hide
)
Description:
Bug 27431: Elasticsearch - escape words that equal to hyphen or starting with more than one hyphen
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2021-01-14 13:16:57 UTC
Size:
1011 bytes
patch
obsolete
>From 362d08b78dbaaf803bfcaf153c285d653fe49054 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 > >--- > 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 d551ad9..1e4a7cd 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -982,6 +982,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.7.4
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