[Bug 24531] New: OAI-PMH sets only consider first field with a given tag
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Bug ID: 24531 Summary: OAI-PMH sets only consider first field with a given tag Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Web services Assignee: koha-bugs@lists.koha-community.org Reporter: magnus@libriotech.no QA Contact: testopia@bugs.koha-community.org -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 --- Comment #1 from Magnus Enger <magnus@libriotech.no> --- A mapping to say that a record should be included in a OAI-PMH set if it has the value "PDF" in field 347$b can be defined as: Field = 347 Subfield = b Operator = equals Value = PDF In C4::OAI::Sets::_evalRule, this is the code that picks out the relevant field and subfield: 544 my @subfield_values = $record->subfield($field, $subfield); But this will only return the value from the first field with tag $field, it does not really work in array context. The code works, if your 347$b = PDF occurs as the first 347 field, but not if it occurs in a subsequent field 347. So the code needs to be expanded into something like this: my @subfield_values; my @fields = $record->field($field); foreach my $field ( @fields ) { if ( my $subfield_value = $field->subfield($subfield) ) { push @subfield_values, $subfield_value; } } -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|OAI-PMH sets only consider |OAI-PMH set mappings only |first field with a given |consider first field with a |tag |given tag -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |magnus@libriotech.no |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 --- Comment #2 from Magnus Enger <magnus@libriotech.no> --- Created attachment 98153 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98153&action=edit Bug 24531 - Test for OAI-PMH sets and repeated fields This patch adds two tests related to OAI-PMH sets. It creates a dummy record with a repeated field, with different values. It then tests if the record is caught by mappings that match the value in the first field, and then if it is caught by mappings that match the second field. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 --- Comment #3 from Magnus Enger <magnus@libriotech.no> --- Created attachment 98154 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98154&action=edit Bug 24531 - Fix OAI-PMH sets for records with repeated fields Currently, an OAI-PMH set mapping will only match if the value it is looking for occurs in the first instance of a repeated field. To test: - Apply the first patch with two new tests - Run something like this: sudo koha-shell -c "prove -v t/db_dependent/OAI/Sets.t" kohadev - Verify that the last test fails - Apply this secind patch - Rerun the test file above - Verify that all tests now pass -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98153|0 |1 is obsolete| | --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 98221 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98221&action=edit Bug 24531 - Test for OAI-PMH sets and repeated fields This patch adds two tests related to OAI-PMH sets. It creates a dummy record with a repeated field, with different values. It then tests if the record is caught by mappings that match the value in the first field, and then if it is caught by mappings that match the second field. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98154|0 |1 is obsolete| | --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 98222 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98222&action=edit Bug 24531 - Fix OAI-PMH sets for records with repeated fields Currently, an OAI-PMH set mapping will only match if the value it is looking for occurs in the first instance of a repeated field. To test: - Apply the first patch with two new tests - Run something like this: sudo koha-shell -c "prove -v t/db_dependent/OAI/Sets.t" kohadev - Verify that the last test fails - Apply this secind patch - Rerun the test file above - Verify that all tests now pass Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |josef.moravec@gmail.com |y.org | CC| |josef.moravec@gmail.com Status|Signed Off |Failed QA --- Comment #6 from Josef Moravec <josef.moravec@gmail.com> --- What if there is repeated subfield with same code in one field? Then only first one is taken into account. I do think we want to count on all of them... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 --- Comment #7 from Magnus Enger <magnus@libriotech.no> --- (In reply to Josef Moravec from comment #6)
What if there is repeated subfield with same code in one field? Then only first one is taken into account. I do think we want to count on all of them...
Gah, how did I miss that? I'll update the patch. Thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98221|0 |1 is obsolete| | --- Comment #8 from Magnus Enger <magnus@libriotech.no> --- Created attachment 98894 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98894&action=edit Bug 24531 - Test for OAI-PMH sets and repeated fields This patch adds two tests related to OAI-PMH sets. It creates a dummy record with a repeated field, with different values. It then tests if the record is caught by mappings that match the value in the first field, and then if it is caught by mappings that match the second field. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98222|0 |1 is obsolete| | --- Comment #9 from Magnus Enger <magnus@libriotech.no> --- Created attachment 98895 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98895&action=edit Bug 24531 - Fix OAI-PMH sets for records with repeated fields Currently, an OAI-PMH set mapping will only match if the value it is looking for occurs in the first instance of a repeated field. To test: - Apply the first patch with two new tests - Run something like this: sudo koha-shell -c "prove -v t/db_dependent/OAI/Sets.t" kohadev - Verify that the last test fails - Apply this secind patch - Rerun the test file above - Verify that all tests now pass -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98894|0 |1 is obsolete| | --- Comment #10 from Magnus Enger <magnus@libriotech.no> --- Created attachment 98896 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98896&action=edit Bug 24531 - Test for OAI-PMH sets and repeated fields This patch adds two tests related to OAI-PMH sets. It creates a dummy record with a repeated field, with different values. It then tests if the record is caught by mappings that match the value in the first field, and then if it is caught by mappings that match the second field. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98895|0 |1 is obsolete| | --- Comment #11 from Magnus Enger <magnus@libriotech.no> --- Created attachment 98897 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98897&action=edit Bug 24531 - Fix OAI-PMH sets for records with repeated fields Currently, an OAI-PMH set mapping will only match if the value it is looking for occurs in the first instance of a repeated field. To test: - Apply the first patch with two new tests - Run something like this: sudo koha-shell -c "prove -v t/db_dependent/OAI/Sets.t" kohadev - Verify that the last test fails - Apply this secind patch - Rerun the test file above - Verify that all tests now pass Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 --- Comment #12 from Magnus Enger <magnus@libriotech.no> --- (In reply to Josef Moravec from comment #6)
What if there is repeated subfield with same code in one field? Then only first one is taken into account. I do think we want to count on all of them...
I have updated the tests and the code to account for repeated subfields. I reset the status to SO, please reset to NSO if necessary. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98896|0 |1 is obsolete| | Attachment #98897|0 |1 is obsolete| | --- Comment #13 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 98906 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98906&action=edit Bug 24531: Test for OAI-PMH sets and repeated fields This patch adds two tests related to OAI-PMH sets. It creates a dummy record with a repeated field, with different values. It then tests if the record is caught by mappings that match the value in the first field, and then if it is caught by mappings that match the second field. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 --- Comment #14 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 98907 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98907&action=edit Bug 24531: Fix OAI-PMH sets for records with repeated fields Currently, an OAI-PMH set mapping will only match if the value it is looking for occurs in the first instance of a repeated field. To test: - Apply the first patch with two new tests - Run something like this: sudo koha-shell -c "prove -v t/db_dependent/OAI/Sets.t" kohadev - Verify that the last test fails - Apply this secind patch - Rerun the test file above - Verify that all tests now pass Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 --- Comment #15 from Josef Moravec <josef.moravec@gmail.com> --- (In reply to Magnus Enger from comment #12)
(In reply to Josef Moravec from comment #6)
What if there is repeated subfield with same code in one field? Then only first one is taken into account. I do think we want to count on all of them...
I have updated the tests and the code to account for repeated subfields. I reset the status to SO, please reset to NSO if necessary.
Thanks Magnus, PQA now -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |20.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 --- Comment #16 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joy@bywatersolutions.com --- Comment #17 from Joy Nelson <joy@bywatersolutions.com> --- does not apply to 19.11.x please rebase if needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 --- Comment #18 from Josef Moravec <josef.moravec@gmail.com> --- (In reply to Joy Nelson from comment #17)
does not apply to 19.11.x please rebase if needed
This patchset fixes the _evaRule sub which was added in Bug 21520. Looking into code I think that in 19.11.x series this bug exist also, but the patch need to be rework because of refactoring made in Bug 21520. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sowder@andrews.edu --- Comment #19 from Tomás Cohen Arazi <tomascohen@gmail.com> --- *** Bug 12731 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24531 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #20 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- *** Bug 29305 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org