Bug 11175: Search using double quotes to support Elasticsearch
authorJoonas Kylmälä <joonas.kylmala@helsinki.fi>
Tue, 24 Nov 2020 17:19:04 +0000 (19:19 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 26 Oct 2021 14:46:02 +0000 (16:46 +0200)
commita819ae07a60cd52f44b9dc5785dd28df79a6a6df
tree86e576dddf851f48d65e2344569c1d5882513836
parentd21e919ba6d398baa727ca2b6a746dac370b2f96
Bug 11175: Search using double quotes to support Elasticsearch

With Elasticsearch if you would use the search string here without the
change to double quotes, i.e.

(rcn='1234' AND cni='FI-XXX') OR rcn='FI-XXX 1234'

then the search would somehow manage to return a record with 001 =
1234 and 003 = FI-XXX. Using double quotes prevents that. Also using
parenthesis around the latter part of the OR seems to work:

(rcn='1234' AND cni='FI-XXX') OR (rcn='FI-XXX 1234')

Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Util/Search.pm
t/Koha/Util/Search.t