How to add new zebra index

From Koha Wiki

Jump to: navigation, search
Home > Documentation
Home > Documentation
Home > Documentation > Search Engine > Zebra
Tips & Tricks > Tips & Tricks/Customising Notices and Slips > Tips & Tricks

Contents

How to Add new marc field to zebra indexes

I searched a lot for direct way to add new field to be searchable with zebra with no luck, so I thought it will be good idea to make one.

Let's do it together step by step.

Step 1

Step 2

  • Edit file named record.abs in this path /etc/koha/zebradb/marc_defs/marc21/biblios/
  • Add this line
 melm 596$a      Note596a:w

Step 2

  • In the file /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml add the following lines:
 <index_data_field xmlns="http://www.koha-community.org/schemas/index-defs" tag="596" subfields="a">
   <target_index>Note596a:w</target_index>
 </index_data_field>

Note

  • 596$a' is the tag and subfield you want to make index for
  • Note596a is the index name
  • :w the type of index (unless you know what you are doing, leave it as ':w')

Step 3

  • Edit file named bib1.att in this path /etc/koha/zebradb/biblios/etc/
  • Add this line
 att 65    Note596a

Note

The attribute number (65 in this example) can be selected from the Bib-1 attribute set (see http://www.loc.gov/z3950/agency/defns/bib1.html#use ) or a new attribute number can be made up.

Note596a is the index name

Step 4

  • Edit file named ccl.properties

In this path /etc/koha/zebradb/

Add this line Note596a 1=65

Note

Note596a is the index name

1=65 is the number of new indexes you add

Step 5

  • Run the following command, you might need to adjust the paths to match those in your installation
 xsltproc /etc/koha/zebradb/xsl/koha-indexdefs-to-zebra.xsl /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >/etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl

Step 6

  • Run the following command
 sudo koha-rebuild-zebra -b -f -v <yourInstance>


Step 7

  • To add the new index in indexes select list in staff search go to
 /usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/includes/
  • Edit search_indexes.inc and add
 <option value="Note596a">Find the first manuscript</option> before </select>

Step 8

  • To add the new index in indexes select list in OPAC search go to
 /usr/share/koha/opac/htdocs/opac-tmpl/prog/en/modules
  • Edit opac-advsearch.tt and add
 <option value="Note596a">Search the first manuscript</option> before </select>

Step 9

  • To add the new index to Refine your search menu go to
 /usr/share/koha/lib/C4/
  • Edit koha.pm go to sub getFacets add the following
 {
   idx   => 'Note596a',
   label => 'first of mono',
   tags  => [ qw/ 596a / ],
   sep   => ', ',
 },

Possible additional steps

It may also be useful to add the index to C4::Search::getIndexes, as that function is used during C4::Search::buildQuery in determining whether to send the query directly to Zebra or to do additional work on the query.

Credits

Special thanks for the Institute of Arabic manuscripts to support these steps And also for Dr. Ahmed Abdalradi

I Hope to be useful for all Ashraf Brzy IT manager Heliopolis University --Ashraf.brzy 15:29, 15 February 2013 (EST)

It has been very helpful for us! Thank you dear Sir! --Olli-Antti Kivilahti, www.vaarakirjastot.fi

Personal tools