Bug 25229 - Elasticsearch should use the authid (record id) rather than the 001 when returning auth search results
Summary: Elasticsearch should use the authid (record id) rather than the 001 when retu...
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-21 13:38 UTC by Nick Clemens
Modified: 2020-05-08 22:12 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.06


Attachments
Bug 25229: Return authid of record rather than 001 (1.26 KB, patch)
2020-04-21 13:48 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 25229: Return authid of record rather than 001 (1.47 KB, patch)
2020-04-27 07:32 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 25229: Unit test (2.82 KB, patch)
2020-04-27 11:34 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 25229: Return authid of record rather than 001 (1.47 KB, patch)
2020-04-27 11:34 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 25229: (follow-up) Move QueryBuilder test to Elasticsearch dir (717 bytes, patch)
2020-04-27 11:37 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 25229: Unit test (2.89 KB, patch)
2020-04-27 12:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 25229: Return authid of record rather than 001 (1.54 KB, patch)
2020-04-27 12:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 25229: (follow-up) Move QueryBuilder test to Elasticsearch dir (788 bytes, patch)
2020-04-27 12:49 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2020-04-21 13:38:37 UTC
To recreate:
0 - Have an environment with both ES and Zebra available
1 - Edit an authority record in the DB to force the 001 and the auth_id to be different
    update auth_header SET marcxml = REPLACE(marcxml,"1707","potato");
2 - Reindex Zebra and ES
3 - View the record in zebra (commands below work on kohadevbox sample data)
    yaz-client unix:/var/run/koha/kohadev/authoritysocket
    base authorities
    find "computer program"
    show 1+14
    Note that the relevant record has the auth id in the 001 even though the record doesn't
4 - View the record in Elasticsearch
    curl -X GET 'localhost:9200/koha_kohadev_authorities/data/1707?pretty'
    Note the 001 is indexed into local number, but the _id of the record matches authid
5 - Search authorities in the staff client for "Computer prorgram" using Zebra
    Note that you can find authid 1707 in the results and view it
6 - Switch search engine to ES and repeat
    Note that you have a result that links to authid=potato and it doesn't work
Comment 1 Nick Clemens 2020-04-21 13:48:48 UTC
Created attachment 103376 [details] [review]
Bug 25229: Return authid of record rather than 001
Comment 2 Nick Clemens 2020-04-21 13:52:17 UTC
As far as I can tell, we do this for zebra in the background. Follow the recreation instructions and see that we index the authid as 001 even if the record is different, which is kinda crazy.

We should at least be consistent.

I have not included tests because we don't really yet have a way to fake ES for tests - we need bug 19821 as there are issues where records created for testing are indexed into ES if search engine config is set, but they don't get removed (for zebra they enter zebraqueue transactionally and are not committed)

Everywhere this code is sued expects the correct authid afacit
Comment 3 Frédéric Demians 2020-04-27 07:32:41 UTC
Created attachment 103738 [details] [review]
Bug 25229: Return authid of record rather than 001

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Document _id field, in authorities ES index, is always authid
Comment 4 Jonathan Druart 2020-04-27 10:16:02 UTC
Tests please?
Comment 5 Nick Clemens 2020-04-27 11:34:23 UTC
Created attachment 103759 [details] [review]
Bug 25229: Unit test
Comment 6 Nick Clemens 2020-04-27 11:34:26 UTC
Created attachment 103760 [details] [review]
Bug 25229: Return authid of record rather than 001

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Document _id field, in authorities ES index, is always authid
Comment 7 Nick Clemens 2020-04-27 11:37:36 UTC
Created attachment 103761 [details] [review]
Bug 25229: (follow-up) Move QueryBuilder test to Elasticsearch dir
Comment 8 Jonathan Druart 2020-04-27 12:49:16 UTC
Created attachment 103779 [details] [review]
Bug 25229: Unit test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Jonathan Druart 2020-04-27 12:49:20 UTC
Created attachment 103780 [details] [review]
Bug 25229: Return authid of record rather than 001

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Document _id field, in authorities ES index, is always authid

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Jonathan Druart 2020-04-27 12:49:24 UTC
Created attachment 103781 [details] [review]
Bug 25229: (follow-up) Move QueryBuilder test to Elasticsearch dir

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Martin Renvoize 2020-04-29 15:25:28 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 12 Joy Nelson 2020-05-08 22:12:09 UTC
Backported to 19.11.x for 19.11.06