Bug 6799

Summary: rebuild_zebra.pl -x produces invalid XML records
Product: Koha Reporter: Frédéric Demians <f.demians>
Component: Architecture, internals, and plumbingAssignee: Frédéric Demians <f.demians>
Status: CLOSED FIXED QA Contact: Bugs List <koha-bugs>
Severity: normal    
Priority: PATCH-Sent (DO NOT USE) CC: dpavlin, julian.maurice, paul.poulain
Version: 3.6   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Proposed patch
Signed off patch

Description Frédéric Demians 2011-08-27 11:38:42 UTC
There are 2 issues with rebuild_zebra.pl since items have been removed
from biblioitems.marcxml:

(1) If some fields (itemcallnumber for example) contains some non-ASCII
characters, items extraction from items table can fail. Items
MARC::Record can't be constructed and fail with an 'invalid wide
character error'.

(2) MARCXML records which are exported into a file are invalid.
Example:

  <datafield tag="915" ind1=" " ind2=" ">
    <subfield code="t">DOCUJ</subfield>
  </datafield>
sion="1.0" encoding="UTF-8"?>
<record
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim.xsd"
    xmlns="http://www.loc.gov/MARC21/slim">

  <leader>                        </leader>
  <datafield tag="995" ind1=" " ind2=" ">
    <subfield code="2">0</subfield>
    <subfield code="k">J 591 CUI</subfield>
    <subfield code="f">0003401004</subfield>
    <subfield code="9">1</subfield>
    <subfield code="c">AMB</subfield>
    <subfield code="o">0</subfield>
    <subfield code="e">1</subfield>
    <subfield code="j">0.00</subfield>
    <subfield code="b">AMB</subfield>
    <subfield code="p">0</subfield>
    <subfield code="q">J</subfield>
  </datafield>
Comment 1 Frédéric Demians 2011-08-27 11:44:13 UTC Comment hidden (obsolete)
Comment 2 Frédéric Demians 2011-09-17 05:21:55 UTC
How to test:

- Stop your zebra indexer cronjob
- Modify the first item of your first biblio record: add a 'é' at the
  end of the Call number field
- Run zebraidx by hand:
  ./rebuild_zebra.pl -r -b -x -nosanitize -k -d ./ -v
- You can stop the process quickly since the first biblio record has
  been exported
- Examine the export file:
  less biblio/exported_records

Result:

- You won't see your 'é' at the end of the first item call number.
- The delimitation between first and second record is wrong.
Comment 3 Julian Maurice 2011-11-04 05:48:54 UTC
Created attachment 6178 [details] [review]
Signed off patch

I reproduced the 2 bugs and this patch fix them. Signed off.
Comment 4 Paul Poulain 2011-11-18 22:32:31 UTC
QA comment: perfect test plan, small patch, passed QA

Patch pushed, please test