Bugzilla – Attachment 5886 Details for
Bug 6789
Biblios with many items can result in broken search results links
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6789: biblios with many items can result in broken search results link
Bug-6789-biblios-with-many-items-can-result-in-bro.patch (text/plain), 4.83 KB, created by
Paul Poulain
on 2011-10-14 09:59:11 UTC
(
hide
)
Description:
Bug 6789: biblios with many items can result in broken search results link
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2011-10-14 09:59:11 UTC
Size:
4.83 KB
patch
obsolete
>From 8b143c6a63a4886f92c6c69c95cd8c78204aa41e Mon Sep 17 00:00:00 2001 >From: Ian Walls <ian.walls@bywatersolutions.com> >Date: Thu, 25 Aug 2011 18:32:51 -0400 >Subject: [PATCH] Bug 6789: biblios with many items can result in broken search results link > >This patch fixes an issue whereby biblios with many items (often > 500) would index, >but not the biblionumber itself, resulting in search results with a) inaccurate item counts >and b) no biblionumber to use in the link to the details page. This is due to Net::Z3950::ZOOM not providing >a mechanism for specifying different connection attributes; the maximumRecordSize ZOOM connection attribute, >if not specified, defaults to 1MB, which is less than the size of a MARC record with many, many 952 fields. Since >it is unlikely we can fix Net::Z3950::ZOOM in a timely fashion, this patch aims to build a workaround on the Koha end. > >This patch changes EmbedItemsInMarcBiblio to use append_fields instead of insert_ordered_fields, >so the 999$c will come before the item records. It's VERY unlikely we will encounter more than 1MB of biblio-level MARC >content, as this would break the ISO-2709 standard by a large factor. > >To this end, it also moves the fix_biblio_ids portion of get_corrected_marc_record out of rebuild_zebra.pl, >and makes it a part of GetMarcBiblio (right before EmbedItemsInMarcBiblio, so the 952s still come last). fix_biblio_ids >is kept as a subroutine for the deletion portion of rebuild_zebra.pl, which still uses it. > >It also uses the subroutine parameter in GetMarcBiblio to do the EmbedItemsInMarcBiblio action, rather than having >rebuild_zebra.pl perform it on the itemless record returned from GetMarcBiblio. Simpler and cleaner that way. > >To verify bug issue: >1. Find a biblio with over 700 items (or enough that the resulting MARCXML is greater than 1MB) >2. search for this biblio (in a search that would return multiple results, not just this title). You should get the title in >the results list >3. attempt to click the link to this biblio's details page; the biblionumber should be blank, leading to a 404 > >To test solution: >1. Apply patch >2. modify the biblio slightly (click the 005 for example) and save > OR manually add the biblio to zebraqueue for reindexing >3. after rebuild_zebra.pl -z -b -x runs, use the same search as above. The title should still appear. >4. click the link, and find yourself on the biblio detail page as desired > >Signed-off-by: D Ruth Bavousett <ruth@bywatersolutions.com> >Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> >--- > C4/Biblio.pm | 4 ++-- > misc/migration_tools/rebuild_zebra.pl | 9 ++------- > 2 files changed, 4 insertions(+), 9 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 752ebe9..f1aaac6 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1072,9 +1072,9 @@ sub GetMarcBiblio { > if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; } > return unless $record; > >+ C4::Biblio::_koha_marc_update_bib_ids($record, '', $biblionumber, $biblionumber); > C4::Biblio::EmbedItemsInMarcBiblio($record, $biblionumber) if ($embeditems); > >- # $record = MARC::Record::new_from_usmarc( $marc) if $marc; > return $record; > } else { > return undef; >@@ -2855,7 +2855,7 @@ sub EmbedItemsInMarcBiblio { > my $item_marc = C4::Items::GetMarcItem($biblionumber, $itemnumber); > push @item_fields, $item_marc->field($itemtag); > } >- $marc->insert_fields_ordered(@item_fields); >+ $marc->append_fields(@item_fields); > } > > =head1 INTERNAL FUNCTIONS >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index dadf43f..6fa6501 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -433,10 +433,7 @@ sub get_corrected_marc_record { > > if (defined $marc) { > fix_leader($marc); >- if ($record_type eq 'biblio') { >- my $succeeded = fix_biblio_ids($marc, $record_number); >- return unless $succeeded; >- } else { >+ if ($record_type eq 'authority') { > fix_authority_id($marc, $record_number); > } > if (C4::Context->preference("marcflavour") eq "UNIMARC") { >@@ -468,7 +465,7 @@ sub get_raw_marc_record { > $fetch_sth->finish(); > return unless $marc; > } else { >- eval { $marc = GetMarcBiblio($record_number); }; >+ eval { $marc = GetMarcBiblio($record_number, 1); }; > if ($@ || !$marc) { > # here we do warn since catching an exception > # means that the bib was found but failed >@@ -477,8 +474,6 @@ sub get_raw_marc_record { > return; > } > } >- # ITEM >- C4::Biblio::EmbedItemsInMarcBiblio($marc, $record_number); > } else { > eval { $marc = GetAuthority($record_number); }; > if ($@) { >-- >1.7.4.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6789
:
5662
|
5679
| 5886