Hi Pedro, it would be fantastic if you could file a bug report[1] and add a patch with your changes, so we can test it and you are credited for it. Cheers, Mirko [1] https://bugs.koha-community.org/bugzilla3/ Pedro Amorim schrieb am 21.04.2016
By the way, using Koha 3.22 from debian packages.
The problem was in CalcOAISetsBiblio function. I managed to solve the problem by changing the foreach in file /usr/share/koha/lib/C4/OAI/Sets.pm:494 to:
foreach my $set_id (keys %$oai_sets_mappings) { foreach my $mapping (@{ $oai_sets_mappings->{$set_id} }) { next if not $mapping; my $field = $mapping->{'marcfield'}; my $subfield = $mapping->{'marcsubfield'}; my $operator = $mapping->{'operator'}; my $value = $mapping->{'marcvalue'}; #my @subfield_values = $record->subfield($field, $subfield); my @field_values = $record->field($field); foreach my $field_value (@field_values){ my @subfield_values = $field_value->subfield($subfield); if ($operator eq 'notequal') { if(0 == grep /^$value$/, @subfield_values) { push @biblio_sets, $set_id; last; } } else { if(0 < grep /^$value$/, @subfield_values) { push @biblio_sets, $set_id; last; } } } } }
The original code was only extracting the *first* item for each biblio, hence why I was only getting 27 records indexed instead of an expected 1141. Those 27 records only had 1 item for each record, in the wanted library. All others have items from several libraries, including the one I wanted.
Hopefully someone will confirm this was a bug and it's solved by the code above.
Thanks,
Pedro Amorim
2016-04-21 15:09 GMT+00:00 Pedro Amorim <pjamorim91@gmail.com>:
Hello all,
I've configured an OAI set mapping with the field 995$a equals "libcode", where 995$a holds the aquisition library code for the item.
As this is an item field, not a biblio field, I have to run build_oai_sets.pl with '-i' option in order to embed items to the records.
This is working fine, however, it's only indexing records which only have 1 item of 'libcode'. Every other biblio with, say, 5 items from different libraries and 1 from 'libcode' library are not indexing.
I think the C4::Biblio::EmbedItemsInMarcBiblio function might be only considering the first item in a biblio, instead of checking all of them.
Has anyone else come across this situation?
Thanks,
Pedro Amorim
_______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha