Bug 6799 - rebuild_zebra.pl -x produces invalid XML records
Summary: rebuild_zebra.pl -x produces invalid XML records
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: 3.6
Hardware: All All
: PATCH-Sent (DO NOT USE) normal (vote)
Target Milestone: ---
Assignee: Frédéric Demians
QA Contact: Bugs List
Depends on:
Reported: 2011-08-27 11:38 UTC by Frédéric Demians
Modified: 2012-10-25 23:10 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:

Proposed patch (2.00 KB, patch)
2011-08-27 11:44 UTC, Frédéric Demians
Details | Diff | Splinter Review
Signed off patch (2.06 KB, patch)
2011-11-04 05:48 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 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.

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

  <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>
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


- 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