Bugzilla – Attachment 116242 Details for
Bug 27597
Searching "kw:term" does not work with Elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27597: Remove extra spaces in the generated query
Bug-27597-Remove-extra-spaces-in-the-generated-que.patch (text/plain), 1.98 KB, created by
Jonathan Druart
on 2021-02-03 09:40:01 UTC
(
hide
)
Description:
Bug 27597: Remove extra spaces in the generated query
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-02-03 09:40:01 UTC
Size:
1.98 KB
patch
obsolete
>From ded3e91a15eebb915a698f369c8caa692e8a2da7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 3 Feb 2021 10:36:06 +0100 >Subject: [PATCH] Bug 27597: Remove extra spaces in the generated query > >Look at the tests, sometime we have extra spaces. >With this patch they still pass and the expected queries are better. >Feel free to drop this patch if you have any concerns about it. >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 2 +- > t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index 174b93738a..6833abb024 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -945,7 +945,7 @@ sub _clean_search_term { > } > > # Remove unquoted colons that have whitespace on either side of them >- $term =~ s/(:+)(\s+)$lookahead/$2/g; >+ $term =~ s/(:+)(\s+)$lookahead//g; > $term =~ s/(\s+)(:+)$lookahead/$1/g; > $term =~ s/^://; > >diff --git a/t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t b/t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >index b2ce6f4319..eb1d44d8a1 100755 >--- a/t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >+++ b/t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >@@ -208,10 +208,10 @@ subtest '_clean_search_term() tests' => sub { > is($res, ' unbalanced quotes ', 'unbalanced quotes removed'); > > $res = $qb->_clean_search_term('test : query'); >- is($res, 'test query', 'dangling colon removed'); >+ is($res, 'test query', 'dangling colon removed'); > > $res = $qb->_clean_search_term('test :: query'); >- is($res, 'test query', 'dangling double colon removed'); >+ is($res, 'test query', 'dangling double colon removed'); > > $res = $qb->_clean_search_term('test "another : query"'); > is($res, 'test "another : query"', 'quoted dangling colon not removed'); >-- >2.20.1
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 27597
:
116241
|
116242
|
117856
|
117857
|
118190