Summary: | Make FindDuplicateAuthority behaviour customizable | ||
---|---|---|---|
Product: | Koha | Reporter: | Julian Maurice <julian.maurice> |
Component: | Cataloging | Assignee: | Bugs List <koha-bugs> |
Status: | Patch doesn't apply --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | bgkriegel, chris, claire.hernandez, fridolin.somers, gmcharlt, jonathan.druart, m.de.rooy, paola.rossi |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31472 | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Bug 8994: Make FindDuplicateAuthority behaviour customizable
Bug 8994: Make FindDuplicateAuthority behaviour customizable Bug 8994: Improve FindDuplicateAuthority Bug 8994: Improve FindDuplicateAuthority |
Description
Julian Maurice
2012-10-31 12:37:57 UTC
Created attachment 13133 [details] [review] Bug 8994: Make FindDuplicateAuthority behaviour customizable With two new sysprefs: - FindDuplicateOptions, - FindDuplicateMaxResults, you can modify the behaviour of this sub in order to fit your needs. You can now search on another index than 'he' and compare subfields of search results. For example, if FindDuplicateOptions is 'he,wrdl/2..ab | See/4..ab', FindDuplicate will search on index 'he' and try to compare $a and $b subfields for all 2XX fields of search results with $a and $b for 2XX fields of newly created authority. If there is no results it will try to search on 'See' index and compare 4XX$a$b of search results with 2XX$a$b of created authority. FindDuplicateMaxResults define how many results should be fetched for comparison. The '/2..ab' part can be omitted from FindDuplicateOptions. In this case, no comparison is made on subfields and the first search result is returned as duplicate. To keep the current behaviour, fill FindDuplicateOptions with 'he,wrdl' (default value in updatedatabase.pl) Note: search on 'at' index is still done in all cases, so only the authorities of the same type are returned. We are currently working on this patch, please do not consider this submission for the moment (In reply to claire.hernandez@biblibre.com from comment #2) > We are currently working on this patch, please do not consider this > submission for the moment Any updates? Created attachment 22465 [details] [review] Bug 8994: Make FindDuplicateAuthority behaviour customizable I've tried to apply the patch against master 3.19.00.012 head 13731 Applying: MT9496: Improve FindDuplicateAuthority Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref Auto-merging installer/data/mysql/updatedatabase.pl CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl Auto-merging installer/data/mysql/sysprefs.sql Auto-merging C4/AuthoritiesMarc.pm CONFLICT (content): Merge conflict in C4/AuthoritiesMarc.pm Failed to merge in the changes. So I pass the patch to "Patch doesn't apply" status. Created attachment 36424 [details] [review] Bug 8994: Improve FindDuplicateAuthority Rebased on master I fixed conflicts to test, also loaded a bunch of auths. But... how is this supposed to be tested? For now, does not apply. But give me a test plan and I will upload a fixed patch. Created attachment 41861 [details] [review] Bug 8994: Improve FindDuplicateAuthority With two new sysprefs: - FindDuplicateOptions, - FindDuplicateMaxResults, you can modify the behaviour of this sub in order to fit your needs. You can now search on another index than 'he' and compare subfields of search results. For example, if FindDuplicateOptions is 'he,wrdl/2..ab | See/4..ab', FindDuplicate will search on index 'he' and try to compare $a and $b subfields for all 2XX fields of search results with $a and $b for 2XX fields of newly created authority. If there is no results it will try to search on 'See' index and compare 4XX$a$b of search results with 2XX$a$b of created authority. FindDuplicateMaxResults define how many results should be fetched for comparison. The '/2..ab' part can be omitted from FindDuplicateOptions. In this case, no comparison is made on subfields and the first search result is returned as duplicate. To keep the current behaviour, fill FindDuplicateOptions with 'he,wrdl' (default value in updatedatabase.pl) Note: search on 'at' index is still done in all cases, so only the authorities of the same type are returned. For the test plan, I'm assuming 2XX authority fields are indexed in a 'he' index and 4XX fields are indexed in a 'See' index. Also, I don't know MARC21 authorities, so the examples here are for UNIMARC. Test plan: 0/ Delete all your authorities and reindex or be sure to use unique strings in the following examples. 1/ Create an authority type T with "Authority field to copy" = "200" 2/ Create a new authority A1 of type T 200$a: Foo 200$b: Bar 400$a: Baz 3/ Set FindDuplicateOptions to 'he,wrdl' (the default) 4/ Reindex authorities 5/ Create a new authority of type T 200$a: Foo A duplicate should be found (A1). Cancel the creation. 6/ Create a new authority of type T 200$a: Baz No duplicate should be found. 7/ Set FindDuplicateOptions to 'he,wrdl/2..a' 8/ Create a new authority of type T 200$a: Foo 200$b: Baz A duplicate should be found (A1). Cancel the creation. 9/ Set FindDuplicateOptions to 'he,wrdl/2..ab' 10/ Create a new authority of type T 200$a: Foo 200$b: Baz No duplicate should be found 11/ Set FindDuplicateOptions to 'See/4..a' 12/ Create a new authority of type T 200$a: Foo No duplicate should be found 14/ Create a new authority of type T 200$a: Baz A duplicate should be found (A1). Cancel the creation. This is a very simple test plan as there can be many more cases to test, but I hope this will make testing easier. There is something that may need clarification, however. The Zebra query is built using the 'index' and 'subfield' parts of the syspref, and the "Authority field to copy" defined in authority type. For example, if: - type T has "Auth field to copy" = 215 - FindDuplicateOptions is 'See/4..ay' - we try to create an authority: 215$a: 'foo', 215$b: 'bar', 215$y: 'baz' The query will look like this: "See = foo and See = baz" (215$b is not used) CONFLICT |