Bug 22874

Summary: Limit to available items doesn't work with elasticsearch 6.x
Product: Koha Reporter: Alex Arnaud <alex.arnaud>
Component: Searching - ElasticsearchAssignee: Alex Arnaud <alex.arnaud>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: black23, e.betemps, martin.renvoize, sandboxes, severine.queune
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00
Circulation function:
Bug Depends on:    
Bug Blocks: 20196    
Attachments: Bug 22874 - use false instaed of 0 value for limiting on availability
Bug 22874 - use false instaed of 0 value for limiting on availability
Bug 22874: Use false instaed of 0 value for limiting on availability

Description Alex Arnaud 2019-05-09 10:29:07 UTC
Currently we send "onloan:0" to ES to get records with available items.
But ES 6 does not considers 0 as a valid boolean.

On ES 6.x:
onloan:0 => doesn't work
onloan:false => works

On ES 5.x:
onloan:0 => works
onloan:false => works

So it seems we can have compatibility for both ES 5 and ES 6 by using false instead of 0.

Patch is coming.
Comment 1 Alex Arnaud 2019-05-09 12:41:06 UTC
Created attachment 89506 [details] [review]
Bug 22874 - use false instaed of 0 value for limiting on availability

Test plan

  - Set up a elasticsearch 6 instance to work with Koha,
  - you may need to make koha works with ES 6 (see bug 20589),
  - make a search and limit it to available items only,
  => no result

  - Apply this patch,
  - make a search and limit it to available items only,
  - you should get some results

  - Do the same with ES 5.x
Comment 2 Séverine Queune 2019-10-01 11:28:54 UTC
Here are the 2 sandboxes I used with : 
  - ES5 : http://pro.es5-koha.sandbox.biblibre.eu
  - ES6 : http://pro.es6-koha.sandbox.biblibre.eu

Sorry Alex, they both failed...
Comment 3 Biblibre Sandboxes 2019-10-01 12:14:13 UTC
Patch tested with a sandbox, by Séverine QUEUNE <severine.queune@bulac.fr>
Comment 4 Biblibre Sandboxes 2019-10-01 12:14:38 UTC
Created attachment 93359 [details] [review]
Bug 22874 - use false instaed of 0 value for limiting on availability

Test plan

  - Set up a elasticsearch 6 instance to work with Koha,
  - you may need to make koha works with ES 6 (see bug 20589),
  - make a search and limit it to available items only,
  => no result

  - Apply this patch,
  - make a search and limit it to available items only,
  - you should get some results

  - Do the same with ES 5.x

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 5 Nick Clemens (kidclamp) 2019-10-25 16:19:51 UTC
Created attachment 94792 [details] [review]
Bug 22874: Use false instaed of 0 value for limiting on availability

Test plan

  - Set up a elasticsearch 6 instance to work with Koha,
  - you may need to make koha works with ES 6 (see bug 20589),
  - make a search and limit it to available items only,
  => no result

  - Apply this patch,
  - make a search and limit it to available items only,
  - you should get some results

  - Do the same with ES 5.x

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Martin Renvoize (ashimema) 2019-10-28 12:39:02 UTC
Nice work!

Pushed to master for 19.11.00