[Koha-devel] Zebra, Query Parsing, Search, All the things

David Cook dcook at prosentient.com.au
Tue Oct 13 08:26:31 CEST 2015


Hi all:

 

I was getting 0 results when I should've been getting 78 results with the
following query:

Host-item:Criminology and criminal justice : an international journal

 

I looked in the Zebra logs, and noticed that it was being transformed into
the following: 

 

@not @and @attr 1=1033 Criminology @and @and @and @and @and criminal justice
= an international journal @attr 1=9011 1

 

If we decompose the RPN, we'll see that it's basically saying:

 

(Host-item=Crimology and ((((criminal and justice) and = ) and
international) and journal )) not Suppression=1

 

The problem is that "=" is going to return 0 results, so the "and" will
always be 0. 

 

The way to remedy this problem is to add quotes around our Host-item
"value":

 

Host-item:"Criminology and criminal justice an international journal"

 

This will produce the following RPN query, which returns 78 results:

 

@not @attr 1=1033 "Criminology and criminal justice = an international
journal" @attr 1=9011 1

 

As far as I can tell, the = symbol is ignored. You can remove it or
substitute another symbol and it'll still return the same number of results.

 

Although it looks like using * for truncation doesn't work in double
quotation marks... I suppose that's because it's already part of a term so
you can't really translate it into RPN separately. 

 

I notice sometimes we strip out double quotation marks from queries and
sometimes we add them in. we should probably do something consistent.

 

David Cook

Systems Librarian

Prosentient Systems

72/330 Wattle St, Ultimo, NSW 2007

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20151013/1e7e5dc6/attachment.html>


More information about the Koha-devel mailing list