Bugzilla – Attachment 70227 Details for
Bug 19905
Don't append wildcard to query terms
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19905 - Don't append wildcard to query terms
Bug-19905---Dont-append-wildcard-to-query-terms.patch (text/plain), 1.63 KB, created by
David Gustafsson
on 2018-01-02 15:52:42 UTC
(
hide
)
Description:
Bug 19905 - Don't append wildcard to query terms
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2018-01-02 15:52:42 UTC
Size:
1.63 KB
patch
obsolete
>From 8f6634cdbb711b94a82a6afb4945a4ac1ff2482b Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Tue, 2 Jan 2018 16:27:18 +0100 >Subject: [PATCH] Bug 19905 - Don't append wildcard to query terms > >Appending '*' to query terms makes Elasticsearch skip search >analysis. This will for example cause issues with search links >in biblio details for values other than a just single term, since >the indexed value has been tokenized. > >How to test: >1) Find a biblio with a field value containing word boundaries and/or >punctuation marks. For example: "au:Author, Name". >2) Perform a search using this query, this should not produce any results. >3) Apply patch. >4) Search using the same query again, it should now produce the expected >results. >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index a021a0cb52..11382a5089 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -801,14 +801,7 @@ sub _truncate_terms { > my @tokens = split /((?:[\w-]+:)?"[^"]+"|\s+)/, $query; > > # Filter out empty tokens >- my @words = grep { $_ !~ /^\s*$/ } @tokens; >- >- # Append '*' to words if needed, ie. if it's not surrounded by quotes, not >- # terminated by '*' and not a keyword >- my @terms = map { >- my $w = $_; >- (/"$/ or /\*$/ or grep {lc($w) eq $_} qw/and or not/) ? $_ : "$_*"; >- } @words; >+ my @terms = grep { $_ !~ /^\s*$/ } @tokens; > > return join ' ', @terms; > } >-- >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 19905
: 70227