Bug 8994 - Make FindDuplicateAuthority behaviour customizable
Summary: Make FindDuplicateAuthority behaviour customizable
Status: Patch doesn't apply
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-31 12:37 UTC by Julian Maurice
Modified: 2022-08-26 16:03 UTC (History)
8 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:


Attachments
Bug 8994: Make FindDuplicateAuthority behaviour customizable (11.47 KB, patch)
2012-10-31 12:39 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 8994: Make FindDuplicateAuthority behaviour customizable (12.41 KB, patch)
2013-10-28 11:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 8994: Improve FindDuplicateAuthority (12.56 KB, patch)
2015-03-03 16:27 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 8994: Improve FindDuplicateAuthority (12.08 KB, patch)
2015-08-24 13:41 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2012-10-31 12:37:57 UTC
Make FindDuplicateAuthority behaviour customizable by adding 2 system preferences.
Comment 1 Julian Maurice 2012-10-31 12:39:32 UTC Comment hidden (obsolete)
Comment 2 claire.hernandez@biblibre.com 2012-11-07 13:31:25 UTC
We are currently working on this patch, please do not consider this submission for the moment
Comment 3 Galen Charlton 2013-08-12 16:46:57 UTC
(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?
Comment 4 Jonathan Druart 2013-10-28 11:33:31 UTC Comment hidden (obsolete)
Comment 5 Paola Rossi 2015-03-03 10:43:37 UTC
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.
Comment 6 Julian Maurice 2015-03-03 16:27:59 UTC Comment hidden (obsolete)
Comment 7 Bernardo Gonzalez Kriegel 2015-05-14 12:33:54 UTC
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.
Comment 8 Julian Maurice 2015-08-24 13:41:14 UTC
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.
Comment 9 Julian Maurice 2015-08-24 14:28:31 UTC
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)
Comment 10 Chris Cormack 2016-03-04 20:15:28 UTC
CONFLICT