Bug 23004

Summary: Missing authtype filter in auth_finder.pl
Product: Koha Reporter: Fridolin SOMERS <fridolin.somers>
Component: Searching - ElasticsearchAssignee: Fridolin SOMERS <fridolin.somers>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: major    
Priority: P5 - low CC: jonathan.druart, lucas, tomascohen
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22997
Change sponsored?: --- Patch complexity: Trivial patch
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.04
Attachments: Bug 23004: Missing authtype filter in auth_finder.pl
Bug 23004: Unit test
Bug 23004: Missing authtype filter in auth_finder.pl
Bug 23004: Missing authtype filter in auth_finder.pl
Bug 23004: Unit test
Bug 23004: Missing authtype filter in auth_finder.pl
Bug 23004: Unit test

Description Fridolin SOMERS 2019-05-29 06:13:47 UTC
In cataloguing, the use of tag editor opens authorities finder with a limit on specific authorities type.
This limit is missing with Elasticsearch.
Comment 1 Fridolin SOMERS 2019-05-29 06:22:39 UTC
Created attachment 90174 [details] [review]
Bug 23004: Missing authtype filter in auth_finder.pl

In cataloguing, the use of tag editor opens authorities finder with a limit on specific authorities type.
This limit is missing with Elasticsearch.

This patch adds in query a "filter" on "term" which is the most performant way because there must be no ranking computed on this part.

Test plan :
1) Use Elasticsearch
2) Create an autority of type author (NP in UNIMARC) with heading "Tolkien"
3) Create an autority of type subject-author (SAUT in UNIMARC) with heading "Tolkien"
4) Create a biblio record
5) Use tag editor on a author field (700 in UNIMARC)
6) Seach for "Tolkien" in $a
without patch : you see the 2 authorities in results
with patch : you see only the correct authority in results (NP in UNIMARC)
7) Check search in authorities-home.pl is still OK
Comment 2 Jonathan Druart 2019-06-19 01:30:58 UTC
Hi Frido, please provide tests to cover this change :)
Comment 3 Fridolin SOMERS 2019-08-08 06:52:24 UTC
Created attachment 92056 [details] [review]
Bug 23004: Unit test

Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
Comment 4 Kyle M Hall 2019-09-06 11:02:49 UTC
Created attachment 92632 [details] [review]
Bug 23004: Missing authtype filter in auth_finder.pl

In cataloguing, the use of tag editor opens authorities finder with a limit on specific authorities type.
This limit is missing with Elasticsearch.

This patch adds in query a "filter" on "term" which is the most performant way because there must be no ranking computed on this part.

Test plan :
1) Use Elasticsearch
2) Create an autority of type author (NP in UNIMARC) with heading "Tolkien"
3) Create an autority of type subject-author (SAUT in UNIMARC) with heading "Tolkien"
4) Create a biblio record
5) Use tag editor on a author field (700 in UNIMARC)
6) Seach for "Tolkien" in $a
without patch : you see the 2 authorities in results
with patch : you see only the correct authority in results (NP in UNIMARC)
7) Check search in authorities-home.pl is still OK

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall 2019-09-06 11:19:57 UTC
Created attachment 92634 [details] [review]
Bug 23004: Missing authtype filter in auth_finder.pl

In cataloguing, the use of tag editor opens authorities finder with a limit on specific authorities type.
This limit is missing with Elasticsearch.

This patch adds in query a "filter" on "term" which is the most performant way because there must be no ranking computed on this part.

Test plan :
1) Use Elasticsearch
2) Create an autority of type author (NP in UNIMARC) with heading "Tolkien"
3) Create an autority of type subject-author (SAUT in UNIMARC) with heading "Tolkien"
4) Create a biblio record
5) Use tag editor on a author field (700 in UNIMARC)
6) Seach for "Tolkien" in $a
without patch : you see the 2 authorities in results
with patch : you see only the correct authority in results (NP in UNIMARC)
7) Check search in authorities-home.pl is still OK

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Kyle M Hall 2019-09-06 11:20:06 UTC
Created attachment 92635 [details] [review]
Bug 23004: Unit test

Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Tomás Cohen Arazi 2019-09-09 16:59:31 UTC
Created attachment 92670 [details] [review]
Bug 23004: Missing authtype filter in auth_finder.pl

In cataloguing, the use of tag editor opens authorities finder with a limit on specific authorities type.
This limit is missing with Elasticsearch.

This patch adds in query a "filter" on "term" which is the most performant way because there must be no ranking computed on this part.

Test plan :
1) Use Elasticsearch
2) Create an autority of type author (NP in UNIMARC) with heading "Tolkien"
3) Create an autority of type subject-author (SAUT in UNIMARC) with heading "Tolkien"
4) Create a biblio record
5) Use tag editor on a author field (700 in UNIMARC)
6) Seach for "Tolkien" in $a
without patch : you see the 2 authorities in results
with patch : you see only the correct authority in results (NP in UNIMARC)
7) Check search in authorities-home.pl is still OK

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 8 Tomás Cohen Arazi 2019-09-09 16:59:36 UTC
Created attachment 92671 [details] [review]
Bug 23004: Unit test

Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 9 Martin Renvoize 2019-09-10 08:36:46 UTC
Nice work!

Pushed to master for 19.11.00
Comment 10 Fridolin SOMERS 2019-09-13 12:51:24 UTC
Pushed to 19.05.x for 19.05.04
Comment 11 Lucas Gass 2019-10-17 19:05:57 UTC
backported to 18.11.x for 18.11.11