Bug 25375: Match current Zebra availability limit
authorNick Clemens <nick@bywatersolutions.com>
Mon, 8 Aug 2022 12:15:16 +0000 (12:15 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Tue, 1 Nov 2022 21:50:41 +0000 (21:50 +0000)
commit245085d202c00f98079912cb72badf901091e163
tree813f7f1eae2f855514197e71666c54ca0dda0386
parent97b58633d04c359276bfc581e64c6e2ac8a97462
Bug 25375: Match current Zebra availability limit

In Zebra the availability limit code states:
'available' is defined as (items.onloan is NULL) and (items.itemlost = 0)

We should make ES follow the same behaviour so that changing the engine does not
change this.

To test:
1 - Find or create several records with two items each
2 - For those records setup items as:
    a - one checked out, one available
    b - both marked lost
    c - both damaged
    d - both withdrawn
    e - both notforloan
3 - Enable ES and reindex to confirm everything is set
4 - Perform an advanced search to return those records and 'limit to available items'
5 - Confirm you see records b,c,d,e and records say '2 items, none available'
6 - Apply patch
7 - Run `misc/search_tools/rebuild_elasticsearch.pl -d -b`
8 - Perform an advanced search to return those records and 'limit to available items'
9 - Confirm you see records a,b,c,d and al but a say '2 items, none available'

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b6ace414f72be24949acb07f1c739bb031cc1faf)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Koha/SearchEngine/Elasticsearch.pm