Hi all,
Who all is using SRU with Zebra? I know that Marcel has been interested in Zebra's SRU since at least 2009, but information is a bit bare out there. I recently received an off-list email asking about Zebra and SRU, especially relevance searching and sorting. I admitted that I only knew about Zebra's Z39.50 functionality, so naturally I started looking into SRU and CQL. I found this webpage to be extremely helpful (alas I only found it after a day or two of experimentation): https://www.loc.gov/standards/sru/cql/spec.html I started by experimenting with CQL in yaz-client. That's as simple as "querytype cql" and "set_cqlfile /home/koha/koha-dev/etc/zebradb/pqf.properties". It took a few minutes to get me head around pqf.properties and that it defaults to using the "dc" set. For all other sets like "bath", you have to prefix with the set name (e.g. bath.name). Z> find title=brand Sent searchRequest. Received SearchResponse. Search was a success. Number of hits: 12, setno 1 SearchResult-1: term=brand cnt=12 records returned: 0 Elapsed: 0.019602 Z> find bath.name=randy Sent searchRequest. Received SearchResponse. Search was a success. Number of hits: 2, setno 2 SearchResult-1: term=randy cnt=2 records returned: 0 Elapsed: 0.020180 I seem to be able to get relevance ranking with the following (= is the relation, and relevant is the relation modifier): Z> find title=/relevant brand Sent searchRequest. Received SearchResponse. Search was a success. Number of hits: 12, setno 9 SearchResult-1: term=brand cnt=12 records returned: 0 Elapsed: 0.001049 Then a A-Z title sort with the following: Z> find title=brand sortby title/sort.ascending Sent searchRequest. Received SearchResponse. Search was a success. Number of hits: 12, setno 11 SearchResult-1: term=brand cnt=12 records returned: 0 Elapsed: 0.001210 So that's CQL in yaz-client, and you can use SRU or Z39.50 for the same result there. So I made the following change to my koha-conf.xml: <!-- <listen id="biblioserver" >unix:/home/koha/koha-dev/var/run/zebradb/bibliosocket</listen> --> <listen id="biblioserver" >tcp:@:9999</listen> Restarted Zebra and started making SRU requests: wget "http://localhost:9999/biblios?version=1.1&operation=searchRetrieve&query=ti tle cql.eq brand&startRecord=1&maximumRecords=10&recordSchema=marcxml" Records in ascending order by biblionumber wget "http://localhost:9999/biblios?version=1.1&operation=searchRetrieve&query=ti tle cql.eq brand sortBy dc.title/sort.ascending&startRecord=1&maximumRecords=10&recordSchema=marcxml " Records in ascending order by dc.title wget "http://localhost:9999/biblios?version=1.1&operation=searchRetrieve&query=ti tle cql.eq/relevant brand&startRecord=1&maximumRecords=10&recordSchema=marcxml" Records in descending order by relevance. This one can be harder to test at a glance. but "format xml" and "elements zebra::meta" will reveal the relevance score of our records in yaz-client! Z> find any=/relevant brand Sent searchRequest. Received SearchResponse. Search was a success. Number of hits: 12, setno 10 SearchResult-1: term=brand cnt=12 records returned: 0 Elapsed: 0.001298 Z> format xml Z> elements zebra::meta Z> show 1 Sent presentRequest (1+1). Records: 1 Record type: XML <record xmlns="http://www.indexdata.com/zebra/" sysno="153" base="biblios" file="/tmp/2LUzuP3K56/upd_biblio/exported_records" type="dom./home/koha/koha-dev/etc/zebradb/biblios/etc/dom-config.xml" score="631" rank="0" size="2881" set="zebra::meta"/> nextResultSetPosition = 2 Elapsed: 0.028276 Z> Sent presentRequest (2+1). Records: 1 Record type: XML <record xmlns="http://www.indexdata.com/zebra/" sysno="50" base="biblios" file="/tmp/2LUzuP3K56/upd_biblio/exported_records" type="dom./home/koha/koha-dev/etc/zebradb/biblios/etc/dom-config.xml" score="612" rank="0" size="2570" set="zebra::meta"/> nextResultSetPosition = 3 Elapsed: 0.000612 You'd think that "rank" would provide useful info, but I think that just relates to static rank (see http://www.indexdata.com/zebra/doc/special-retrieval.html). Score is what we want here. Note that score appears to only appear for relevance queries. Anyway. I hope that info is useful to some of you, and I'd be curious if others have any neat tips for using SRU. I don't know if I'll be using it any time soon, but it's interesting to think about, even in anticipation of ElasticSearch. David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Office: 02 9212 0899 Direct: 02 8005 0595
_______________________________________________ Koha-devel mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
