Bug 24264

Summary: Elasticsearch - Cannot search for genre/form authorities
Product: Koha Reporter: Nick Clemens <nick>
Component: Searching - ElasticsearchAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P5 - low CC: lucas, martin.renvoize, mkstephens
Version: 19.05   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24286
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.05.07
Attachments: Bug 24264: Use raw field when limiting by authtype
Bug 24264: Use raw field when limiting by authtype
Bug 24264: Use raw field when limiting by authtype
Bug 24264: Use raw field when limiting by authtype

Description Nick Clemens 2019-12-18 14:11:46 UTC
When search with an authtype in ES we are using the term filter to limit to a type. This filter is analyzed and the forward slash in genre/form seems to be problematic

bug 20589 fixed this incidentally to other changes, however, 19.05 still has this bug.
Comment 1 Nick Clemens 2019-12-18 14:14:56 UTC
Created attachment 96421 [details] [review]
Bug 24264: Use raw field when limiting by authtype

To test:
1 - Have a genre form record in your authorities file
2 - Search authorities for 'Default'
3 - The result is returned
4 - Set the dropdown to 'Genre/Form' and search matchign term
5 - No results
6 - Apply patch
7 - Restart all the things
8 - Repeat search for 'Genre/Form' and search matching term
9 - Record is returned
Comment 2 Myka Kennedy Stephens 2019-12-25 19:03:16 UTC
I'm sorry, Nick, but I can't get the patch to apply. I've tried on two different systems (Mac and Linux) using docker.

Results:
Setup: 19.05.x branch (19.05.06.000 on last attempt); ES enabled, query auto truncate turned off
1. There are 13 authority records in the test database containing "fiction"
2. 'Default' authority search for "fiction" 
3. Yields 13 results - 3 topical and 10 genre/form
4. 'Genre/Form Term' authority search for "fiction"
5. Yields 0 results
6. Apply patch
7. restart_all, updatedatabase, dbic, reindex ES
8. 'Genre/Form Term' authority search for "fiction"
9. Yields 0 results

Plack error log doesn't show anything. If there's another place to check for errors to troubleshoot the patch, please let me know.
Comment 3 Nick Clemens 2019-12-30 12:30:17 UTC
Created attachment 96682 [details] [review]
Bug 24264: Use raw field when limiting by authtype

To test:
1 - Have a genre form record in your authorities file
2 - Search authorities for 'Default'
3 - The result is returned
4 - Set the dropdown to 'Genre/Form' and search matchign term
5 - No results
6 - Apply patch
7 - Restart all the things
8 - Repeat search for 'Genre/Form' and search matching term
9 - Record is returned
Comment 4 Nick Clemens 2019-12-30 12:32:17 UTC
(In reply to Myka Kennedy Stephens from comment #2)
> I'm sorry, Nick, but I can't get the patch to apply. I've tried on two
> different systems (Mac and Linux) using docker.
> 
Hi Myka,

'Patch does not apply' is for when there are errors when trying to apply the patch

'Failed QA' is for when a patch doesn't work after it is applied. That was the case here, I wrote a bad patch :-)

When using 'raw' we also need to remove the lowercasing, otherwise it doesn't match.

New patch attached, please retest
Comment 5 Myka Kennedy Stephens 2019-12-31 01:10:24 UTC
Created attachment 96694 [details] [review]
Bug 24264: Use raw field when limiting by authtype

To test:
1 - Have a genre form record in your authorities file
2 - Search authorities for 'Default'
3 - The result is returned
4 - Set the dropdown to 'Genre/Form' and search matchign term
5 - No results
6 - Apply patch
7 - Restart all the things
8 - Repeat search for 'Genre/Form' and search matching term
9 - Record is returned

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
Comment 6 Myka Kennedy Stephens 2019-12-31 01:11:27 UTC
(In reply to Nick Clemens from comment #4)
> 
> New patch attached, please retest

Patch worked as expected this time. Thanks, Nick!
Comment 7 Jonathan Druart 2020-01-02 11:41:02 UTC
Created attachment 96733 [details] [review]
Bug 24264: Use raw field when limiting by authtype

To test:
1 - Have a genre form record in your authorities file
2 - Search authorities for 'Default'
3 - The result is returned
4 - Set the dropdown to 'Genre/Form' and search matchign term
5 - No results
6 - Apply patch
7 - Restart all the things
8 - Repeat search for 'Genre/Form' and search matching term
9 - Record is returned

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Lucas Gass 2020-01-17 14:47:03 UTC
backported to 19.05.x for 19.05.07