Bug 21084: Fix automatic truncation in authority search
authorEre Maijala <ere.maijala@helsinki.fi>
Wed, 5 Dec 2018 14:27:43 +0000 (16:27 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 23 Jan 2019 12:43:33 +0000 (12:43 +0000)
commit66e041fece11281273d0120fe0f66f2d5901c518
tree4c8d10acd9c4d920818957cbede87b4c7aebf377
parent2b4bf11fa9acc54c87a9e7b5039baf0ecd0ef2d4
Bug 21084: Fix automatic truncation in authority search

- Makes token splitting work like in biblio search
- Only adds right hand truncation since that's what Zebra also does
- Only adds truncation if the token is not a phrase and ends in a word character
- Adds tests to existing and new QueryBuilder functions

Test plan:

1. Create an authority record for "Duck, Donald"
2. Try contains type authority searches with the following terms and make sure they find the record:
Duck, Donald
donald duck
don duck
"Duck, Donald"
3. Make sure the following search works but does not find anything:
"Duck, Don"

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 0d9a42b492ca21cc14fab69d0facb80aeb8dcff4)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t [new file with mode: 0644]
t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t