Bug 24567: Don't strip spaces along with dangling colons
authorNick Clemens <nick@bywatersolutions.com>
Tue, 27 Oct 2020 11:26:53 +0000 (11:26 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 4 Nov 2020 13:49:11 +0000 (14:49 +0100)
commit6ce56f1134d99280af30e128f57189b285966180
tree22b7b6539918c63d86f65db2a2ad44ef6d155e57
parent0b565d1c7a46291bae89c5cc33fca246202c6988
Bug 24567: Don't strip spaces along with dangling colons

This updates the regex used for removing colons to capture those with space on either side, and remove the colon
while preserving the space

To test:
 1 - Have Koha using ES
 2 - Search for:
    ti:chess AND chess
 3 - You should get a result in sample data, otherwise replace 'chess' with a title in your catalogue
 4 - Search for:
    ti:chess AND kw:chess
 5 - No result
 6 - Enable  DumpTemplateVarsIntranet  and  DumpSearchQueryTemplate
 7 - Repeate search and check page source
 8 - search_query has:
    title:chess ANDchess
 9 - Apply patch
10 - Repeat
11 - Seaerch works!
12 - query is now:
     title:chess AND chess

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Bug 24567: (follow-up) Use dollar sign to refer to captures

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t