[Koha-devel] Searching numeric ranges

David Cook dcook at prosentient.com.au
Tue Nov 10 04:56:35 CET 2015


After sending an email to Adam at Indexdata (and the Zebra/YAZ lists), I need to revise my last comment on this thread…

 

The URL cgi-bin/koha/catalogue/search.pl?q=ccl%3Dlex%2Cst-numeric%3D500-600 is better read as lex,st-numeric:500-600 which works.

 

However, the URL cgi-bin/koha/catalogue/search.pl?idx=lex%2Cst-numeric <http://search.pl?idx=lex%2Cst-numeric&q=500-600> &q=500-600 creates the CCL query (rk=( lex,st-numeric="300-600")) which is translated into PQF as @attr 1=9903 @attr 4=109 @attr 2=102 300-600, which generates the error [117] Unsupported Relation attribute -- v2 addinfo ''.

 

The problem is due to the rk=() and the double quotes. 

 

The double quotes make CCL2RPN think that it’s a single term and not a range. So it doesn’t do the r=r/r=o magic. If you remove those quotes to form a CCL query of (rk=( lex,st-numeric=300-600)), you’ll get a PQF query of @and @attr 1=9903 @attr 4=109 @attr 2=102 300 @attr 1=9903 @attr 4=109 @attr 2=102 600, which still generates the error [117] Unsupported Relation attribute -- v2 addinfo ''… but it’s more in line with what we’d expect the PQF query to look like.

 

You might notice here that the problem with the query is that the relation attributes of @attr 2=4 and @attr 2=2 are being replaced with @attr 2=102. This means it won’t be treated as a range, which is definitely not what we want!

 

But we don’t even get that far… we get that error because it seems that the @attr 4=109 structure attribute doesn’t seem to play nicely with @attr 2=102 (relevance). 

 

I think it’s a bug in the CCL2RPN conversion. The rk=() is specified at a higher level than the r=r/r=o special attributes, so the @attr 2=4 and @attr 2=2 attributes shouldn’t be overwritten. However, we’ll see what Indexdata has to say about the issue…

 

 

David Cook

Systems Librarian

Prosentient Systems

72/330 Wattle St, Ultimo, NSW 2007

 

From: koha-devel-bounces at lists.koha-community.org [mailto:koha-devel-bounces at lists.koha-community.org] On Behalf Of Barton Chittenden
Sent: Friday, 6 November 2015 3:47 AM
To: Koha-devel <koha-devel at lists.koha-community.org>
Subject: [Koha-devel] Searching numeric ranges

 

I am working on searching lexile number ranges.

 

ccl.properties shows

 

    lex 1=9903 r=r

 

The 'r=r' bit means that I should be able to search using a numeric range separated by a dash, e.g.

 

   500-600

 

Should return any numeric results from 500 to 600.

 

The following query works:

 

   cgi-bin/koha/catalogue/search.pl?q=ccl%3Dlex%2Cst-numeric%3D500-600 <http://search.pl?q=ccl%3Dlex%2Cst-numeric%3D500-600> 

 

However, when I try adding that as an item in the search menu, as follows:

 

    $(document).ready(function(){

 

        //add lexile to search pull downs

        $("select[name='idx']").append("<option value='lex,st-numeric'>Lexile (e.g. 600 or 550-650 )</option>");

 

    }); 

 

That gets munged... the url reads

 

    cgi-bin/koha/catalogue/search.pl?idx=lex%2Cst-numeric <http://search.pl?idx=lex%2Cst-numeric&q=500-600> &q=500-600

 

 

And I get the following message:

 

    No results found

    No results match your search for 'lex,st-numeric: 500-600'. 

 

--Barton

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20151110/88ffc528/attachment-0001.html>


More information about the Koha-devel mailing list