Bug 18374: Respect QueryAutoTruncate syspref in Elasticsearch
commit4c4d982ae45a3763fd70faedf1bbac225213de19
authorNick Clemens <nick@bywatersolutions.com>
Mon, 3 Apr 2017 18:30:44 +0000 (3 14:30 -0400)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 13 Oct 2017 16:01:12 +0000 (13 13:01 -0300)
tree5d580979d9bdbeebb58e044a6fb7c5232c4a7edc
parent8b3d53db08a5d27a22df338ea4c3c2426992c12a
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>
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm