Bug 25278

Summary: Search fields cache must be separate for different indexes under Elasticsearch
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Searching - ElasticsearchAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: 1joynelson, ere.maijala, jonathan.druart, lucas, m.de.rooy, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.06
Circulation function:
Bug Depends on: 13937, 23137, 25277    
Bug Blocks:    
Attachments: Bug 25278: Retrieve correct search fields for authorities
Bug 25278: Retrieve correct search fields for authorities
Bug 25278: Unit tests
Bug 25278: (follow-up) Fix other occurrences
Bug 25278: Unit tests
Bug 25278: Retrieve correct search fields for authorities
Bug 25278: (follow-up) Fix other occurrences
Bug 25278: add clear_search_fields_cache method
Bug 25278: Unit tests
Bug 25278: Retrieve correct search fields for authorities
Bug 25278: (follow-up) Fix other occurrences
Bug 25278: add clear_search_fields_cache method

Description Nick Clemens (kidclamp) 2020-04-24 13:38:10 UTC
On top of 25277 authorities are not searchable under elasticsearch - query is built on bib fields
Comment 1 Nick Clemens (kidclamp) 2020-04-24 15:53:11 UTC
Created attachment 103697 [details] [review]
Bug 25278: Retrieve correct search fields for authorities
Comment 2 Nick Clemens (kidclamp) 2020-04-24 15:56:20 UTC
When we are determining which fields to search we check the cache and retrieve if the search fields are not cached

It seems that although we check the index when retrieving the fields, we don't note the index when caching.

This means that authorities searches of the entire record can end up searching the biblio fields, and biblio searches will use the authorities fields if those are returned first.

We can fix this simply by adding the index to the cache key
Comment 3 Nick Clemens (kidclamp) 2020-04-24 16:33:01 UTC
Created attachment 103699 [details] [review]
Bug 25278: Retrieve correct search fields for authorities
Comment 4 Nick Clemens (kidclamp) 2020-04-24 16:33:04 UTC
Created attachment 103700 [details] [review]
Bug 25278: Unit tests
Comment 5 Jonathan Druart 2020-04-27 13:26:32 UTC
What about the other occurrences?
Comment 6 Nick Clemens (kidclamp) 2020-04-27 14:06:18 UTC
Created attachment 103793 [details] [review]
Bug 25278: (follow-up) Fix other occurrences
Comment 7 Victor Grousset/tuxayo 2020-05-14 19:06:23 UTC
Created attachment 104896 [details] [review]
Bug 25278: Unit tests

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 8 Victor Grousset/tuxayo 2020-05-14 19:06:26 UTC
Created attachment 104897 [details] [review]
Bug 25278: Retrieve correct search fields for authorities

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 9 Victor Grousset/tuxayo 2020-05-14 19:06:30 UTC
Created attachment 104898 [details] [review]
Bug 25278: (follow-up) Fix other occurrences

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 10 Victor Grousset/tuxayo 2020-05-14 19:10:55 UTC
Applied only the tests; ran => failed
Then applied the fix => passed :D

(also looked at the code, nothing wrong noticed, though not much was understood ^^")
Comment 11 Jonathan Druart 2020-05-15 07:56:20 UTC
Nick, 4 occurrences, please move that to a method.
Comment 12 Nick Clemens (kidclamp) 2020-05-15 11:56:13 UTC
Created attachment 104939 [details] [review]
Bug 25278: add clear_search_fields_cache method
Comment 13 Jonathan Druart 2020-05-15 13:18:24 UTC
Created attachment 104944 [details] [review]
Bug 25278: Unit tests

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 14 Jonathan Druart 2020-05-15 13:18:28 UTC
Created attachment 104945 [details] [review]
Bug 25278: Retrieve correct search fields for authorities

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 15 Jonathan Druart 2020-05-15 13:18:31 UTC
Created attachment 104946 [details] [review]
Bug 25278: (follow-up) Fix other occurrences

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 16 Jonathan Druart 2020-05-15 13:18:35 UTC
Created attachment 104947 [details] [review]
Bug 25278: add clear_search_fields_cache method

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 17 Martin Renvoize (ashimema) 2020-05-18 14:29:10 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 18 Joy Nelson 2020-05-19 23:06:14 UTC
backported to 19.11.x for 19.11.06
Comment 19 Lucas Gass (lukeg) 2020-05-22 14:39:55 UTC
missing dependencies for 19.05.x, no backport