Bug 30047 - Add a field to auth_header to record main heading as text string
Summary: Add a field to auth_header to record main heading as text string
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Nick Clemens (kidclamp)
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks: 38133 36917
  Show dependency treegraph
 
Reported: 2022-02-08 15:26 UTC by Andrew Fuerste-Henry
Modified: 2024-10-09 17:05 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00
Circulation function:


Attachments
Bug 30047: DB Updates (1.84 KB, patch)
2024-01-19 14:29 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 30047: DO NOT PUSH - Schema updates (1.42 KB, patch)
2024-01-19 14:30 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 30047: Add new heading field to auth_header table (4.56 KB, patch)
2024-01-19 14:30 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 30047: Unit tests (3.42 KB, patch)
2024-01-19 14:30 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 30047: DB Updates (1.89 KB, patch)
2024-01-19 15:37 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 30047: DO NOT PUSH - Schema updates (1.47 KB, patch)
2024-01-19 15:37 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 30047: Add new heading field to auth_header table (4.61 KB, patch)
2024-01-19 15:37 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 30047: Unit tests (3.48 KB, patch)
2024-01-19 15:37 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 30047: DB Updates (1.99 KB, patch)
2024-05-10 09:52 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 30047: DO NOT PUSH - Schema updates (1.57 KB, patch)
2024-05-10 09:52 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 30047: Add new heading field to auth_header table (4.71 KB, patch)
2024-05-10 09:52 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 30047: Unit tests (3.58 KB, patch)
2024-05-10 09:52 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 30047: (follow-up) Fix failing tests (7.83 KB, patch)
2024-05-13 14:18 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2022-02-08 15:26:15 UTC
SQL queries looking at authority records are complicated by the fact that authorities don't have an equivalent to a biblio's title. It would be helpful to create a new database field (auth_header.main_heading) in which we record a text string. The specific value we record here would be determined by the authority type, following the mappings defined in authtypes.pl.
Comment 1 Katrin Fischer 2022-02-19 21:30:41 UTC
+1
Comment 2 Nick Clemens (kidclamp) 2024-01-19 14:29:59 UTC
Created attachment 161208 [details] [review]
Bug 30047: DB Updates
Comment 3 Nick Clemens (kidclamp) 2024-01-19 14:30:01 UTC
Created attachment 161209 [details] [review]
Bug 30047: DO NOT PUSH - Schema updates
Comment 4 Nick Clemens (kidclamp) 2024-01-19 14:30:03 UTC
Created attachment 161210 [details] [review]
Bug 30047: Add new heading field to auth_header table

This patch adds a new heading field containing the display form of the authority record

NOTE: If trying to save an auhority in the 'DEFAULT' framework, you will get an error, you should not be
using DEFAULT for authorities and we should remove from the list on another bug

To test:
1 - Apply patches
2 - Update database
3 - Restart all
4 - Create a new authority, save.
5 - Do this for various types
6 - View the db records:
    SELECT * FROM auth_header\G
7 - Note new heading field is populated correctly
8 - Edit your new authorities
9 - Confirm the heading field is updated correctly
10 - Import some authorities and confirm heading generated correctly
11 - Import auth via Z39.50 and confirm heading generated correctly
Comment 5 Nick Clemens (kidclamp) 2024-01-19 14:30:05 UTC
Created attachment 161211 [details] [review]
Bug 30047: Unit tests
Comment 6 Biblibre Sandboxes 2024-01-19 15:37:47 UTC
Created attachment 161213 [details] [review]
Bug 30047: DB Updates

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 7 Biblibre Sandboxes 2024-01-19 15:37:49 UTC
Created attachment 161214 [details] [review]
Bug 30047: DO NOT PUSH - Schema updates

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 8 Biblibre Sandboxes 2024-01-19 15:37:51 UTC
Created attachment 161215 [details] [review]
Bug 30047: Add new heading field to auth_header table

This patch adds a new heading field containing the display form of the authority record

NOTE: If trying to save an auhority in the 'DEFAULT' framework, you will get an error, you should not be
using DEFAULT for authorities and we should remove from the list on another bug

To test:
1 - Apply patches
2 - Update database
3 - Restart all
4 - Create a new authority, save.
5 - Do this for various types
6 - View the db records:
    SELECT * FROM auth_header\G
7 - Note new heading field is populated correctly
8 - Edit your new authorities
9 - Confirm the heading field is updated correctly
10 - Import some authorities and confirm heading generated correctly
11 - Import auth via Z39.50 and confirm heading generated correctly

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 9 Biblibre Sandboxes 2024-01-19 15:37:53 UTC
Created attachment 161216 [details] [review]
Bug 30047: Unit tests

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 10 Marcel de Rooy 2024-05-10 09:50:46 UTC
We do not have a script touching all authorities? That could fill the table for existing records?
Another idea to accomplish that and mention in release notes?
Comment 11 Marcel de Rooy 2024-05-10 09:52:23 UTC
Created attachment 166522 [details] [review]
Bug 30047: DB Updates

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 12 Marcel de Rooy 2024-05-10 09:52:25 UTC
Created attachment 166523 [details] [review]
Bug 30047: DO NOT PUSH - Schema updates

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 13 Marcel de Rooy 2024-05-10 09:52:27 UTC
Created attachment 166524 [details] [review]
Bug 30047: Add new heading field to auth_header table

This patch adds a new heading field containing the display form of the authority record

NOTE: If trying to save an auhority in the 'DEFAULT' framework, you will get an error, you should not be
using DEFAULT for authorities and we should remove from the list on another bug

To test:
1 - Apply patches
2 - Update database
3 - Restart all
4 - Create a new authority, save.
5 - Do this for various types
6 - View the db records:
    SELECT * FROM auth_header\G
7 - Note new heading field is populated correctly
8 - Edit your new authorities
9 - Confirm the heading field is updated correctly
10 - Import some authorities and confirm heading generated correctly
11 - Import auth via Z39.50 and confirm heading generated correctly

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 14 Marcel de Rooy 2024-05-10 09:52:30 UTC
Created attachment 166525 [details] [review]
Bug 30047: Unit tests

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 15 Marcel de Rooy 2024-05-10 10:55:43 UTC
(In reply to Marcel de Rooy from comment #10)
> We do not have a script touching all authorities? That could fill the table
> for existing records?
> Another idea to accomplish that and mention in release notes?

Something with misc/maintenance/update_authorities.pl ?
Comment 16 Katrin Fischer 2024-05-10 14:04:51 UTC
This looks a bit like a change I didn't see advertised here? It's obv correct... but I don't like sneaky code ;)

     '151' => {
-        auth_type  => 'GEOG_NAME',
+        auth_type  => 'GEOGR_NAME',
         subfields  => 'avxyz68',
         main_entry => 1

We have some open bugs for problems with this authority type. Including a fix in an enh patch means it won't be fixed in stable versions. RMaints will pass over this one.
Comment 17 Katrin Fischer 2024-05-10 14:46:48 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 18 Tomás Cohen Arazi (tcohen) 2024-05-10 20:42:52 UTC
This broke t/db_dependent/Biblio.t
Comment 19 Katrin Fischer 2024-05-13 07:32:51 UTC
(In reply to Tomás Cohen Arazi from comment #18)
> This broke t/db_dependent/Biblio.t

I suspect more than Biblio.t, a lot of the authority related tests are failing:

*  t_db_dependent_api_v1_authorities_t
*  t_db_dependent_Koha_Authorities_t
*  t_db_dependent_Koha_Plugins_authority_hooks_t
*  t_db_dependent_Authority_Merge_t

(copied from Jenkins, translate _)
Comment 20 Nick Clemens (kidclamp) 2024-05-13 14:18:48 UTC
Created attachment 166644 [details] [review]
Bug 30047: (follow-up) Fix failing tests

This patch updates the test files to correctly create authorities and/or correctly
mock the needed data for authorities.

the tests in t/db_dependent/Authority/Merge.t cover the case of 'Default' authorities
which don't have valid headings - so I had to add handling for blanking the heading field
when Default type is used.
Comment 21 Katrin Fischer 2024-05-13 14:23:58 UTC
Picked follow-up for pushing to main, thx!
Comment 22 Fridolin Somers 2024-05-29 09:03:41 UTC
Not backported to 23.11.x
Comment 23 David Cook 2024-09-30 01:50:10 UTC
This is awesome. I can't believe I didn't know about it until now!

--

Thinking about indexing...

On one hand, it's a shame that an index wasn't added for the heading column. On the other hand, off the top of my head I'm not sure if the index should be on the heading or on the heading and authtypecode.

Additionally, "heading" is longtext, which can't be indexed without specifying a (limited) length. Of course, we wouldn't need a unique index. Just an index that could help search performance. 

Anyway... just going to leave that here for now. We can always see how it goes in production and then improve it if necessary...
Comment 24 Caroline Cyr La Rose 2024-10-03 20:01:34 UTC
(In reply to Marcel de Rooy from comment #15)
> (In reply to Marcel de Rooy from comment #10)
> > We do not have a script touching all authorities? That could fill the table
> > for existing records?
> > Another idea to accomplish that and mention in release notes?
> 
> Something with misc/maintenance/update_authorities.pl ?

This was not addressed, unless I'm missing something? Upon upgrade, is there something to do to populate this column in existing systems?
Comment 25 David Cook 2024-10-09 04:56:08 UTC
(In reply to Caroline Cyr La Rose from comment #24)
> (In reply to Marcel de Rooy from comment #15)
> > (In reply to Marcel de Rooy from comment #10)
> > > We do not have a script touching all authorities? That could fill the table
> > > for existing records?
> > > Another idea to accomplish that and mention in release notes?
> > 
> > Something with misc/maintenance/update_authorities.pl ?
> 
> This was not addressed, unless I'm missing something? Upon upgrade, is there
> something to do to populate this column in existing systems?

Yeah, it doesn't look like it was addressed. I reckon a new touch_all_authorities.pl might be a good way to go.
Comment 26 Caroline Cyr La Rose 2024-10-09 17:05:00 UTC
I created(In reply to David Cook from comment #25)
> (In reply to Caroline Cyr La Rose from comment #24)
> > (In reply to Marcel de Rooy from comment #15)
> > > (In reply to Marcel de Rooy from comment #10)
> > > > We do not have a script touching all authorities? That could fill the table
> > > > for existing records?
> > > > Another idea to accomplish that and mention in release notes?
> > > 
> > > Something with misc/maintenance/update_authorities.pl ?
> > 
> > This was not addressed, unless I'm missing something? Upon upgrade, is there
> > something to do to populate this column in existing systems?
> 
> Yeah, it doesn't look like it was addressed. I reckon a new
> touch_all_authorities.pl might be a good way to go.

I created Bug 38133.
Unfortunately, this is useless to existing systems right now without a script to populate the new column.