Bug 18374: Respect QueryAutoTruncate syspref in Elasticsearch
commitb5497c87ccc7ee2c01f4177e335aee25fbeb6c53
authorNick Clemens <nick@bywatersolutions.com>
Mon, 3 Apr 2017 18:30:44 +0000 (3 14:30 -0400)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 25 Oct 2017 07:59:45 +0000 (25 09:59 +0200)
tree698c92372631d60023828b7464fed118ef3e0cb0
parent9a5ee28fe6a67e66a8407f8838f2acf6606c6a4d
Bug 18374: Respect QueryAutoTruncate syspref in Elasticsearch

This patchset adds a subroutine '_truncate_terms' to the ES QueryParser.

If QueryAutoTruncate is enabled this function will be called for any
search to add wildcard '*' to all terms

To test:
1 - Enable Elasticsearch and have some records indexed
2 - Search for partial terms
3 - Note they fail unless '*' is appended
4 - Apply patch, leave QueryAutoTruncate disabled
5 - Note partial term searches still fail
6 - Enable QueryAutoTruncate
7 - Note partial term searches succeed
8 - Do some regular and advanced searches to make sure results are as
expected

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4c4d982ae45a3763fd70faedf1bbac225213de19)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm