Bug 26199

Summary: Record matching rule match check should include Leader/LDR
Product: Koha Reporter: David Cook <dcook>
Component: MARC Bibliographic record staging/importAssignee: David Cook <dcook>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: enhancement    
Priority: P5 - low CC: andrewfh, fridolin.somers, m.de.rooy
Version: unspecifiedKeywords: Manual
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27087
Change sponsored?: Sponsored Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This patch extends the functionality of the existing record matching rules by allowing comparisons based on the fixed-length MARC leader. To reference the leader in a matching rule, enter "LDR" for the MARC tag in your matching rule setup. The offset and length values can be used to further refine your match.
Version(s) released in:
21.05.00,20.11.04
Attachments: Bug 26199: Include LDR for match check/match point
Bug 26199: Include LDR for match check/match point
Bug 26199: Include LDR for match check/match point

Description David Cook 2020-08-13 02:29:19 UTC
At the moment, record matching rule match checks can only use control fields and data fields. It would be great if they could also use the leader. 

This is very useful for matching against LDR06 for instance when you want to make sure that you're getting text instead of an audiobook for instance.
Comment 1 Andrew Fuerste-Henry 2020-08-13 12:20:09 UTC
+1, I've had libraries ask for this
Comment 2 David Cook 2020-12-17 04:08:45 UTC
Created attachment 114468 [details] [review]
Bug 26199: Include LDR for match check/match point

This patch adds the ability to specify the LDR instead of a numeric tag
when defining match checks in record matching rules. This is particularly
useful for checking LDR6 "Type of record" when importing records.

Test plan:
0. prove t/Matcher.t

1. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=1
2. Click "Save" and choose "MARCXML"
3. Copy bib-1.marcxml to bib-1-mod.marcxml
4. Change "01344cam a22003014i 4500" to "01344cmm a22003014i 4500"
5. Go to http://localhost:8081/cgi-bin/koha/admin/matching-rules.pl?op=edit_matching_rule&matcher_id=3
6. Click "Add match check"
7. Fill out the match checks:
Source:
Tag: LDR
Offset: 6
Length: 1
Target:
Tag: LDR
Offset: 6
Length: 1

8. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
9. Choose "bib-1-mod.marcxml" and click "Upload file"
10. Choose "KohaBiblio (999$c)" for "Record matching rule"
11. Click "Stage for import"
12. Click "Manage staged records" on resulting page
13. Note the "Match type" says "No match"

14. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
15. Choose "bib-1.marcxml" and click "Upload file"
16. Choose "KohaBiblio (999$c)" for "Record matching rule"
17. Click "Stage for import"
18. Click "Manage staged records" on resulting page
19. Note the Match type says "Match found"
Comment 3 Andrew Fuerste-Henry 2020-12-17 13:38:25 UTC
Created attachment 114478 [details] [review]
Bug 26199: Include LDR for match check/match point

This patch adds the ability to specify the LDR instead of a numeric tag
when defining match checks in record matching rules. This is particularly
useful for checking LDR6 "Type of record" when importing records.

Test plan:
0. prove t/Matcher.t

1. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=1
2. Click "Save" and choose "MARCXML"
3. Copy bib-1.marcxml to bib-1-mod.marcxml
4. Change "01344cam a22003014i 4500" to "01344cmm a22003014i 4500"
5. Go to http://localhost:8081/cgi-bin/koha/admin/matching-rules.pl?op=edit_matching_rule&matcher_id=3
6. Click "Add match check"
7. Fill out the match checks:
Source:
Tag: LDR
Offset: 6
Length: 1
Target:
Tag: LDR
Offset: 6
Length: 1

8. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
9. Choose "bib-1-mod.marcxml" and click "Upload file"
10. Choose "KohaBiblio (999$c)" for "Record matching rule"
11. Click "Stage for import"
12. Click "Manage staged records" on resulting page
13. Note the "Match type" says "No match"

14. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
15. Choose "bib-1.marcxml" and click "Upload file"
16. Choose "KohaBiblio (999$c)" for "Record matching rule"
17. Click "Stage for import"
18. Click "Manage staged records" on resulting page
19. Note the Match type says "Match found"

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 4 Andrew Fuerste-Henry 2020-12-17 13:41:22 UTC
Thanks David! I added a See Also to bug 27087, which is sort of tangential, just in case it catches your eye :)
Comment 5 David Cook 2020-12-18 01:23:28 UTC
(In reply to Andrew Fuerste-Henry from comment #4)
> Thanks David! I added a See Also to bug 27087, which is sort of tangential,
> just in case it catches your eye :)

Thanks for testing! And that bug sounds interesting!
Comment 6 Marcel de Rooy 2021-03-05 08:40:35 UTC
Created attachment 117788 [details] [review]
Bug 26199: Include LDR for match check/match point

This patch adds the ability to specify the LDR instead of a numeric tag
when defining match checks in record matching rules. This is particularly
useful for checking LDR6 "Type of record" when importing records.

Test plan:
0. prove t/Matcher.t

1. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=1
2. Click "Save" and choose "MARCXML"
3. Copy bib-1.marcxml to bib-1-mod.marcxml
4. Change "01344cam a22003014i 4500" to "01344cmm a22003014i 4500"
5. Go to http://localhost:8081/cgi-bin/koha/admin/matching-rules.pl?op=edit_matching_rule&matcher_id=3
6. Click "Add match check"
7. Fill out the match checks:
Source:
Tag: LDR
Offset: 6
Length: 1
Target:
Tag: LDR
Offset: 6
Length: 1

8. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
9. Choose "bib-1-mod.marcxml" and click "Upload file"
10. Choose "KohaBiblio (999$c)" for "Record matching rule"
11. Click "Stage for import"
12. Click "Manage staged records" on resulting page
13. Note the "Match type" says "No match"

14. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
15. Choose "bib-1.marcxml" and click "Upload file"
16. Choose "KohaBiblio (999$c)" for "Record matching rule"
17. Click "Stage for import"
18. Click "Manage staged records" on resulting page
19. Note the Match type says "Match found"

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Marcel de Rooy 2021-03-05 08:42:09 UTC
Looks good to me.
Bit cheating in the code where we pretend that LDR is a field tag.
Same for the interface.
We need to make clear in the manual that we support this now.
Release notes ?
Comment 8 Jonathan Druart 2021-03-09 16:19:46 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 9 Fridolin Somers 2021-03-19 13:45:45 UTC
Small useful enhancement, I choose to backport.

Pushed to 20.11.x for 20.11.04
Comment 10 Andrew Fuerste-Henry 2021-03-23 12:18:37 UTC
Enhancement, not backported to 20.05