Bug 6499

Summary: MARC21 035 -- Other-control-number -- Indexing & Matching
Product: Koha Reporter: Nicole C. Engard <nengard>
Component: CatalogingAssignee: Barton Chittenden <barton>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: enhancement    
Priority: P5 - low CC: barton, chris, f.demians, koha.sekjal, kyle, m.de.rooy, nick, paul, srdjan, tmisilo, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16986
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Added a new Zebra index "Other-control-number" covering MARC21 035$a, 035$z and 035 (entire tag). To display it in Intranet search and in Opac search you need to use javascript to list it. Not present in template files.
Version(s) released in:
Circulation function:
Bug Depends on: 6256    
Bug Blocks: 12546    
Attachments: Bug 6499 - OCLC # Indexing & Matching
Change zebra index "OCLC-Number" to "Other-control-number"
Add Zebra index "Other-control-number" covering MARC21 035$a, 035$z and 035 (entire tag)
Add Zebra index "Other-control-number" covering MARC21 035$a, 035$z and 035 (entire tag)
[SIGNED-OFF] Bug 6499: Add Zebra index "Other-control-number" covering MARC21 035$a, 035$z and 035 (entire tag)
Bug 6499: Add Zebra index "Other-control-number" covering MARC21 035$a, 035$z and 035 (entire tag)
Bug 6499: [QA Follow-up] Trivial adjustments

Description Nicole C. Engard 2011-06-14 12:47:26 UTC
I know that anyone can add indexes and matching rules, but recently we have gotten many more libraries asking for indexes and matching rules on OCLC number (Marc21 035). This enhancement request is me asking if we could get these added in as defaults.
Comment 1 Barton Chittenden 2014-07-09 17:48:26 UTC Comment hidden (obsolete)
Comment 2 Barton Chittenden 2014-07-09 18:15:12 UTC
Testing:

1) Make sure that you have a bib that has MARC21 035$a (and possibly also 035$z) populated.
2) Rebuild zebra: misc/migration_tools/rebuild_zebra.pl -x -b -z
3) Add the following to the intranetuserjs syspref:

$(document).ready(function(){
    // Add OCLC Number to advanced search
    if (window.location.href.indexOf("catalogue/search.pl") > -1) {
        $(".advsearch").append('<option value="OCLC_Number,w">OCLC Number</option>');
    }
}  

Do an advanced search, select OCLC Number from the search menu, then add the OCLC Number in 035$a for the bib specified in step 1.

The advanced search should return that biblio record.
Comment 3 Katrin Fischer 2014-07-09 23:08:16 UTC
Hm, I am not happy with naming this index oclc-number - 035 is not only the OCLC number, although it can contain one. For example in our database one 035 always contains the PPN - the unique identifier from our union catalog SWB.

035
A control number of a system other than the one whose control number is contained in field 001 (Control Number), field 010 (Library of Congress Control Number) or field 016 (National Bibliographic Agency Control Number). (Repeatable) [a,z,6,8]
Comment 4 Katrin Fischer 2014-07-09 23:12:36 UTC
I think a better name might be other-control-number?
Comment 5 Barton Chittenden 2014-07-10 14:02:38 UTC Comment hidden (obsolete)
Comment 6 Barton Chittenden 2014-07-15 15:48:57 UTC
Updated test procedure. After patch is applied: 

1) Make sure that you have a bib that has MARC21 035$a (and possibly also 035$z) populated.
2) Rebuild zebra: misc/migration_tools/rebuild_zebra.pl -x -b -z
3) Add the following to the intranetuserjs syspref:

$(document).ready(function(){
    // Add Other Control Number to advanced search
    if (window.location.href.indexOf("catalogue/search.pl") > -1) {
        $(".advsearch").append('<option value="Other-control-number,w">Other Control Number</option>');
    }
}  

Do an advanced search, select "Other Control Number" from the search menu, then add the Other Control Number in 035$a for the bib specified in step 1.

The advanced search should return that biblio record.
Comment 7 Barton Chittenden 2015-02-05 13:26:29 UTC
Changed title of bug to remove pesky '#' character, and to better classify the change being made.
Comment 8 Kyle M Hall (khall) 2015-02-20 19:25:59 UTC Comment hidden (obsolete)
Comment 9 Barton Chittenden 2015-02-20 19:28:25 UTC
Updated test procedure. After patch is applied: 

1) Make sure that you have a bib that has MARC21 035$a (and possibly also 035$z) populated.
2) Rebuild zebra: misc/migration_tools/rebuild_zebra.pl -x -b -z
3) Add the following to the intranetuserjs syspref:

$(document).ready(function(){
    // Add Other Control Number to advanced search
    if (window.location.href.indexOf("catalogue/search.pl") > -1) {
        $(".advsearch").append('<option value="Other-control-number">Other Control Number</option>');
    }
}  

Do an advanced search, select "Other Control Number" from the search menu, then add the Other Control Number in 035$a for the bib specified in step 1.

The advanced search should return that biblio record.
Comment 10 Barton Chittenden 2015-02-20 19:32:15 UTC
Katrin,

I've cleaned up the patch, and updated the testing procedures (minor change to javascript in the test procedure). The patch should apply to MASTER.
Comment 11 Nick Clemens (kidclamp) 2015-02-20 22:30:03 UTC Comment hidden (obsolete)
Comment 12 Katrin Fischer 2015-03-06 14:00:47 UTC
I am not able to spot the problem in the filess, but it doesn't work for me.
I have:
- copied all the index related files to my koha-dev folder
- restarted zebra
- done a full reindex

I am puzzled. I am going to fail this for now, but would be happy if someone else tested if it works for them.
Comment 13 Barton Chittenden 2015-03-06 17:01:03 UTC
Katrin,

about.pl on the koha installation that I was using lists

Zebra version:	Zebra 2.0.55 (C) 1994-2013, Index Data ApS Zebra is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. SHA1 ID: bd2bc9360225e695bbaba2c2d1cd6925c4eb23a5 Using ICU

Could this be an issue of zebra version?

Nick,

Could you check Main->About on your test machine, and report the zebra version that worked for you?

[Zebra version is the last item on the 'about' page]

Thanks,

--Barton
Comment 14 Barton Chittenden 2015-03-06 17:43:05 UTC
Katrin,

I ran the following in yaz-client:

yaz-client -c etc/zebradb/ccl.properties unix:/home/barton/koha-dev/var/run/zebradb/bibliosocket
Connecting...OK.
Sent initrequest.
Connection accepted by v3 target.
ID     : 81
Name   : Zebra Information Server/GFS/YAZ
Version: 2.0.55/4.2.69 026ad3d737be4cbba4e98c6b6dc753f8029e3655
Options: search present delSet triggerResourceCtrl scan sort extendedServices namedResultSets
Elapsed: 0.002972
Z> base biblios                                                                                                                                                                                                                                                                
Z> scan @attr 1=1211 ocm03545607
query: @attr 1=1211 ocm03545607
Received ScanResponse
5 entries, position=1
Scan returned code 5
* ocm03545607 (1)
  ocm05041760 (1)
  ocm06098807 (1)
  OCoLC (4)
  VOY12798 (1)
Elapsed: 0.071230
Z> 

---

Do you get errors when you run the following commands in yaz-client?

base biblios                                                                                                                                                                                                                                                                
scan @attr 1=1211 <your value in 035$a>
Comment 15 Nick Clemens (kidclamp) 2015-03-06 19:11:24 UTC
I tested successfully on a clean branch again today using kohadevbox, zebra version:
Zebra 2.0.60 (C) 1994-2015, Index Data Zebra is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. SHA1 ID: b51184e7cf9eabd2c609f50f721d6568351fbc33 Using ICU

Just to note, the js is missing closing ");" and should be

$(document).ready(function(){
    // Add Other Control Number to advanced search
    if (window.location.href.indexOf("catalogue/search.pl") > -1) {
        $(".advsearch").append('<option value="Other-control-number">Other Control Number</option>');
    }
});
Comment 16 Barton Chittenden 2015-04-07 19:20:51 UTC
Notes for Katrin and/or other QA: Nick Clemens tested this successfully on a clean kohadevbox install; noted that the javascript in my test procedure was missing the closing ");"

I have seen issues recently where 'gitify' does not take into account the fact that $KOHA_CONF needs to point to an instance specific version of zebra-biblios-dom.cfg -- it stays pointed to the package version, which has the wrong profilePath. This will cause any changes made to DOM indexes to be ignored... so before testing, you might want to do the following:

* grep zebra-biblios-dom.cfg $KOHA_CONF

  This will show you the path to zebra-biblios-dom.cfg.

* grep profilePath [PATH TO zebra-biblios-dom.cfg]/zebra-biblios-dom.cfg

  If profilePath does not include your git directory (e.g. kohaclone), your tests will fail.

Here's an updated test procedure, including the corrected javascript.

1) Apply patch
2) Make sure that you have a bib that has MARC21 035$a (and possibly also 035$z) populated.
3) Rebuild zebra: misc/migration_tools/rebuild_zebra.pl -x -b -z
4) Add the following to the intranetuserjs syspref:

$(document).ready(function(){
    // Add Other Control Number to advanced search
    if (window.location.href.indexOf("catalogue/search.pl") > -1) {
        $(".advsearch").append('<option value="Other-control-number">Other Control Number</option>');
    }
}); 

5) Do an advanced search, select "Other Control Number" from the search menu, then add the Other Control Number in 035$a for the bib specified in step 1.

The advanced search should return that biblio record.
Comment 17 Bernardo Gonzalez Kriegel 2015-05-12 17:11:50 UTC Comment hidden (obsolete)
Comment 18 Marcel de Rooy 2015-08-20 11:58:02 UTC
Created attachment 41710 [details] [review]
Bug 6499: Add Zebra index "Other-control-number" covering MARC21 035$a, 035$z and 035 (entire tag)

1) Apply patch
2) Make sure that you have a bib that has MARC21 035$a (and possibly also 035$z) populated.

pre 3) Replace all modified zebra files and restart zebra server

3) Rebuild zebra: misc/migration_tools/rebuild_zebra.pl -x -b -z
4) Add the following to the intranetuserjs syspref:

$(document).ready(function(){
    // Add Other Control Number to advanced search
    if (window.location.href.indexOf("catalogue/search.pl") > -1) {
        $(".advsearch").append('<option value="Other-control-number">Other Control Number</option>');
    }
});

5) Do an advanced search, select "Other Control Number" from the search menu, then add the Other Control Number in 035$a for the bib specified in step 1.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works, no koha-qa errors

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 19 Marcel de Rooy 2015-08-20 11:58:06 UTC
Created attachment 41711 [details] [review]
Bug 6499: [QA Follow-up] Trivial adjustments

Removes commented line from bib1.att.
Adjust OCLC-number to Other-control-number in comment of ccl properties.
No need to explicitly add 035$a and $z if you index 035 completely in
record.abs as well as biblio-koha-indexdefs.xml.
Rerun koha-indexdefs-to-zebra.xsl on index defs.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 20 Marcel de Rooy 2015-08-20 12:03:24 UTC
QA Comment:
Works for me, added a followup.
The test plan includes an addition to intranetuserjs to use this field. But many users will miss that of course. If you really would need it in the menu, you could do that on a separate report. Full-text search will find it too of course now.

Instead of Other-control-number perhaps System-control-number would still 
have been closer to the LOC naming :) No problem for me.

Passed QA
Comment 21 Tomás Cohen Arazi (tcohen) 2015-09-07 14:50:51 UTC
Barton, there is no need to touch record.abs (not blocker) but you are missing the queryparser.yaml file in your patchset.
Comment 22 Katrin Fischer 2016-07-27 05:16:12 UTC
*** Bug 16986 has been marked as a duplicate of this bug. ***
Comment 23 Tomás Cohen Arazi (tcohen) 2016-08-01 13:25:10 UTC
The QueryParser configuration file has diverged and shouldn't be a blocker for this one IMHO.
Comment 24 Katrin Fischer 2016-08-02 05:18:37 UTC
*** Bug 16986 has been marked as a duplicate of this bug. ***
Comment 25 Kyle M Hall (khall) 2016-08-09 10:15:19 UTC
Pushed to master for 16.11, thanks Barton, Marcel!
Comment 26 Frédéric Demians 2016-08-17 14:02:21 UTC
Pushed in 16.05. Will be in 16.05.03.
Comment 27 Paul Hoffman 2018-08-09 15:22:49 UTC
FYI, in our Koha instance (17.11.04) I had to use this in IntranetUserJS:

<option value="Other-control-number,phr">

Instead of this:

<option value="Other-control-number">

Without ",phr" I found it was doing a ",wrdl" search which failed.

Others may find that this is not necessary, but I mention it here for anyone who stumbles upon this only to find that the suggested code doesn't work for them.