Making more indexes searchable with Zebra SRU

From Koha Wiki
Jump to navigation Jump to search

Which indexes are searchable from SRU is governed by the config file etc/zebradb/pqf.properties. Initially the searchable indexes is somewhat limited, so you might want to add some more.

Let's say you are using MARC21 and want to be able to search for the values in MARC field 952$y - "Koha item type". There are three files you need to look at:

record.abs

etc/zebradb/marc_defs/marc21/biblios/record.abs (Use the file that is appropriate for your MARC dialect!)

This file says in which index Zebra should index 952$y:

melm 952$y      itype:w,itype:p

The name of the Zebra index is itype.

bib1.att

etc/zebradb/biblios/etc/bib1.att

Now we look for itype in bib1.att and find this:

att 8031    itype

So the information from 952$y is now in bib1 attribute 8031.

pqf.properties

etc/zebradb/pqf.properties

We look for 8031 in pqf.properties, but it is nowhere to be found! If we want to be able to search for the information from 952$y available for searching from SRU, we need to edit pqf.properties. Add something like this under the other index.dc.* entries:

index.dc.kohaitemtype   = 1=8031

(Putting this into the dc "namspace" might not be a good idea, it might be better to define a new "namespace" called local or something similar, but I have not actually tested that...)

Now restart Zebra:

sudo /etc/init.d/koha-zebra-daemon restart

And you should be able to search on the new index, like this:

http://example.org:9998/biblios?version=1.1&operation=searchRetrieve&query=dc.kohaitemtype=BK&maximumRecords=100

The process will be similar for other MARC fields and subfields.