Bug 34693 - Add 035$a as Other-control-number index in authorities search indexes (MARC21, Elasticsearch)
Summary: Add 035$a as Other-control-number index in authorities search indexes (MARC21...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Caroline Cyr La Rose
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-01 15:42 UTC by Caroline Cyr La Rose
Modified: 2024-07-11 14:30 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/896
Text to go in the release notes:
This patch adds 035$a in the default MARC21 Elasticsearch authority indexes. For existing installations, make sure you reindex with the option -r (reset mappings) to have this information in the index for existing records.
Version(s) released in:
24.05.00
Circulation function:


Attachments
Bug 34693: Add 035$a as Other-control-number index in default authorities search indexes (2.96 KB, patch)
2023-09-01 19:28 UTC, Caroline Cyr La Rose
Details | Diff | Splinter Review
Bug 34693: Add 035$a as Other-control-number index in default authorities search indexes (3.01 KB, patch)
2024-03-05 22:23 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2023-09-01 15:42:08 UTC
The only "number" that is indexed in authority records is 001, which is Koha's auth_id. This makes it difficult to add matching rules to import new records since Koha replaces the record's actual control number with its own. 

I propose to add 035$a as Other-control-number index for authority records. 

This would help do matching checks when importing authority records.
Comment 1 Caroline Cyr La Rose 2023-09-01 19:28:58 UTC
Created attachment 155152 [details] [review]
Bug 34693: Add 035$a as Other-control-number index in default authorities search indexes

This patch adds a new index for authorities, Other-control-number, and maps it to 035$a.

This will help when trying to match authority records when importing external records.

Test 1:
0. Make sure Elasticsearch is set as the search engine
1. Apply patch and restart
2. Import the attached record
   2.1. Go to Cataloging > Stage records for import
   2.2. Choose the file
   2.3. Click Upload file
   2.4. Choose Record type: Authority
   2.5. Click Stage for import
   (wait until the job is finished...)
   2.6. Click View batch
   2.7. Click Import this batch into the catalog
   (wait until the job is finished...)
   2.8. Click Manage imported batch
   2.9. Click View next to the record
   2.10. Note the auth id number

3. Examine the ES entry for the record (replace INDEX_NAME with the index name (found in koha-conf.xml and XX with the auth_id)

curl -XGET 'http://localhost:9200/INDEX_NAME_authorities/data/XX?_source_includes=other-control-number&pretty'

--> It should give you the value of 035$a

Test 2 (optional):
1. Steps 1 and 2 as above
2. Add a matching rule to match on 035$a for authority records
   2.1. Go to Administration > Record matching rules
   2.2. Click New record matching rule
   2.3. Fill out the form
        - Matching rule code: enter a code (for example AUTCONTROL)
        - Description: enter a description (for example 035$a for authorities)
        - Match threshold: 100
        - Record type: Authority record
        - Search index: Other-control-number
        - Score: 100
        - Tag: 035
        - Subfields: a
   2.4. Click Save
3. Import the same record again, checking for matches using the new rule
   3.1. Go to Cataloging > Stage records for import
   3.2. Choose the file
   3.3. Click Upload file
   3.4. Choose Record type: Authority
   3.5. Choose Record matching rule: rule created above
   2.6. Click Stage for import
   (wait until the job is finished...)
   --> It should say that 1 record was found using the rule
Comment 2 Caroline Cyr La Rose 2023-09-01 19:33:05 UTC
I wrote in the release notes that for existing installations, we have to reset mappings. I'm sure it's true for existing records, but I'm not sure for records added after the upgrade. If the mappings are not reset, I'm not sure what it does. Does the new mapping just stay in limbo?
Comment 3 Lucas Gass (lukeg) 2024-03-05 22:23:21 UTC
Created attachment 162795 [details] [review]
Bug 34693: Add 035$a as Other-control-number index in default authorities search indexes

This patch adds a new index for authorities, Other-control-number, and maps it to 035$a.

This will help when trying to match authority records when importing external records.

Test 1:
0. Make sure Elasticsearch is set as the search engine
1. Apply patch and restart
2. Import the attached record
   2.1. Go to Cataloging > Stage records for import
   2.2. Choose the file
   2.3. Click Upload file
   2.4. Choose Record type: Authority
   2.5. Click Stage for import
   (wait until the job is finished...)
   2.6. Click View batch
   2.7. Click Import this batch into the catalog
   (wait until the job is finished...)
   2.8. Click Manage imported batch
   2.9. Click View next to the record
   2.10. Note the auth id number

3. Examine the ES entry for the record (replace INDEX_NAME with the index name (found in koha-conf.xml and XX with the auth_id)

curl -XGET 'http://localhost:9200/INDEX_NAME_authorities/data/XX?_source_includes=other-control-number&pretty'

--> It should give you the value of 035$a

Test 2 (optional):
1. Steps 1 and 2 as above
2. Add a matching rule to match on 035$a for authority records
   2.1. Go to Administration > Record matching rules
   2.2. Click New record matching rule
   2.3. Fill out the form
        - Matching rule code: enter a code (for example AUTCONTROL)
        - Description: enter a description (for example 035$a for authorities)
        - Match threshold: 100
        - Record type: Authority record
        - Search index: Other-control-number
        - Score: 100
        - Tag: 035
        - Subfields: a
   2.4. Click Save
3. Import the same record again, checking for matches using the new rule
   3.1. Go to Cataloging > Stage records for import
   3.2. Choose the file
   3.3. Click Upload file
   3.4. Choose Record type: Authority
   3.5. Choose Record matching rule: rule created above
   2.6. Click Stage for import
   (wait until the job is finished...)
   --> It should say that 1 record was found using the rule

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 4 Katrin Fischer 2024-05-06 07:19:47 UTC
Grabbing this simple one out of the QA queue.
Comment 5 Katrin Fischer 2024-05-06 09:18:50 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 6 Fridolin Somers 2024-05-24 13:28:34 UTC
Not backported to 23.11.x