Bug 17547

Summary: (MARC21) Chronological term link subfield 648$9 not indexed
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: MARC Bibliographic data supportAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: hagud, jonathan.druart, julian.maurice, katrin.fischer, kyle, magnus, mtj
Version: 16.11   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17788
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 17547: (MARC21|NORMARC) have Chronological term field $9 indexed
Bug 17547: (MARC21|NORMARC) have Chronological term field $9 indexed

Description Tomás Cohen Arazi 2016-11-03 15:18:40 UTC
Even though the authority search in the OPAC allows searching Chronological term authority records, the 'usage' column is always 0, because searching for linked bibliographical records always returns 0. This is because 648$9 is not being added in the Koha-Auth-Number index
Comment 1 Tomás Cohen Arazi 2016-12-02 20:52:14 UTC
Created attachment 57946 [details] [review]
Bug 17547: (MARC21|NORMARC) have Chronological term field $9 indexed

This patch makes Zebra index the 648$9 link for chronological terms on
bibliographic records. This way an authority search on chronological terms
will show the right number in 'Used in X records' message.

To test:
- Have a record with a 648 field, linked to an authority record (i.e. with an authid on 648$9).
- Search for the record, notice it is indexed.
- Perform an authority search for the chronological term
=> FAIL: the term is linked to our record, but koha shows '0' count.
- Apply the patch
- Run:
  $ cd kohaclone
  $ xsltproc etc/zebra/xsl/koha-indexdefs-to-zebra.xsl \
       etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml \
     > etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
  $ git diff
=> SUCCESS: Notice the shipped etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
   is up-to-date
- Run:
  $ sudo cp etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl \
            /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
  $ sudo koha-restart-zebra kohadev
  $ sudo koha-rebuild-zebra -f -b -v kohadev
- Search for the record, notice it is indexed.
- Perform an authority search for the chronological term
=> SUCCESS: the term is linked to our record, usage count is 1
- Sign off :-D

I assume NORMARC is similar on this regard. Feel free to fail it if the NORMARC part of the
patch is wrong.

Sponsored-by: Universidad Nacional de Cordoba
Comment 2 Hugo Agud 2016-12-07 11:42:38 UTC
We have applied the patch and it works.. just a litle note, there is a mispelling in the test plan

Instead of

sudo xsltproc etc/zebra/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl 

the right one is

sudo xsltproc etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml > etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
Comment 3 Jonathan Druart 2016-12-12 12:47:46 UTC
(In reply to Tomás Cohen Arazi from comment #1)
> I assume NORMARC is similar on this regard. Feel free to fail it if the
> NORMARC part of the
> patch is wrong.

Magnus, could you confirm?
Comment 4 Magnus Enger 2016-12-12 13:35:02 UTC
(In reply to Jonathan Druart from comment #3)
> (In reply to Tomás Cohen Arazi from comment #1)
> > I assume NORMARC is similar on this regard. Feel free to fail it if the
> > NORMARC part of the
> > patch is wrong.
> 
> Magnus, could you confirm?

Akshuly, there is no 648 in NORMARC, and no other field is used for "Chronological term" either, as far as I can tell.
Comment 5 Jonathan Druart 2016-12-13 15:32:03 UTC
Does that mean we need to remove NORMARC changes, to keep them or that does not matter? :)
Comment 6 Magnus Enger 2016-12-13 18:25:09 UTC
(In reply to Jonathan Druart from comment #5)
> Does that mean we need to remove NORMARC changes, to keep them or that does
> not matter? :)

My gut feeling says to just keep them. It should not hurt anyone.
Comment 7 Jonathan Druart 2016-12-14 11:04:29 UTC
Created attachment 58168 [details] [review]
Bug 17547: (MARC21|NORMARC) have Chronological term field $9 indexed

This patch makes Zebra index the 648$9 link for chronological terms on
bibliographic records. This way an authority search on chronological terms
will show the right number in 'Used in X records' message.

To test:
- Have a record with a 648 field, linked to an authority record (i.e. with an authid on 648$9).
- Search for the record, notice it is indexed.
- Perform an authority search for the chronological term
=> FAIL: the term is linked to our record, but koha shows '0' count.
- Apply the patch
- Run:
  $ cd kohaclone
  $ xsltproc etc/zebra/xsl/koha-indexdefs-to-zebra.xsl \
       etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml \
     > etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
  $ git diff
=> SUCCESS: Notice the shipped etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
   is up-to-date
- Run:
  $ sudo cp etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl \
            /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
  $ sudo koha-restart-zebra kohadev
  $ sudo koha-rebuild-zebra -f -b -v kohadev
- Search for the record, notice it is indexed.
- Perform an authority search for the chronological term
=> SUCCESS: the term is linked to our record, usage count is 1
- Sign off :-D

I assume NORMARC is similar on this regard. Feel free to fail it if the NORMARC part of the
patch is wrong.

Sponsored-by: Universidad Nacional de Cordoba

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Kyle M Hall 2016-12-16 11:27:13 UTC
Pushed to master for 17.05, thanks Tomas!
Comment 9 Katrin Fischer 2016-12-18 20:32:05 UTC
This patch has been pushed to 16.11.x, will be in 16.11.01.
Comment 10 Julian Maurice 2017-01-02 11:28:11 UTC
Pushed to 3.22.x for 3.22.14
Comment 11 Mason James 2017-01-29 11:40:26 UTC
Pushed to 16.05.x, for 16.05.06 release