Bug 25375: Fix 'available' facet in elasticsearch
authorJulian Maurice <julian.maurice@biblibre.com>
Wed, 29 Apr 2020 14:13:08 +0000 (16:13 +0200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 23 Sep 2022 12:01:23 +0000 (09:01 -0300)
commitd79361c51e9349a5bbbe3212fde40d3ad4d6b946
treef09599b65dd08e6d749271ecef02100209e69b64
parent6523db73214c57d6a6b8ea2d4c3731445ccddf1f
Bug 25375: Fix 'available' facet in elasticsearch

Add a new boolean ES field named 'available', which is true if at least
one item is available, which means the item is not on loan, not
"notforloan", not withdrawn, not lost and not damaged

A full indexation is required

Test plan:
1. Apply patch and run updatedatabase.pl
2. Run `misc/search_tools/rebuild_elasticsearch.pl -d -b`
3. Make sure you have some biblios whose items are all unavailable, some
   biblios whose items are all available, and some biblios with at least
   one item available and at least one item unavailable
4. Use the 'available' filter on both opac and intranet and make sure it
   works as expected.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/SearchEngine/Elasticsearch.pm
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
admin/searchengine/elasticsearch/mappings.yaml
installer/data/mysql/atomicupdate/bug-25375.perl [new file with mode: 0644]