Koha Test Wiki MW Canasta on Koha Portainer

Test major Koha Wiki changes or bug fixes here without fear of breaking the production wiki.

For the current Koha Wiki, visit https://wiki.koha-community.org .

How to add new zebra index

From Koha Test Wiki MW Canasta on Koha Portainer
Jump to navigation Jump to search

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

  • 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

Step 3

  • In the file /etc/koha/zebradb/biblios/etc/bib1.att add the following 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

  • In the file /etc/koha/zebradb/ccl.properties add the following 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


xsltproc is a command line XSLT processor. This will overwrite biblio-zebra-indexdefs.xsl with your modified biblio-koha-indexdefs.xml using koha-indexdefs-to-zebra.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

or, in more recent versions, e.g. 20.n:

 /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/<lng>/modules, e.g.
 /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/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.

See also

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