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 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&q=500-600 And I get the following message: No results found No results match your search for 'lex,st-numeric: 500-600'. --Barton
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@lists.koha-community.org [mailto:koha-devel-bounces@lists.koha-community.org] On Behalf Of Barton Chittenden Sent: Friday, 6 November 2015 3:47 AM To: Koha-devel <koha-devel@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
I’ve got a response from Adam at Indexdata. Impressed as always by the speed in which he replies! David: …it seems to me that CCL2RPN isn’t working correctly when a CCL qualifier for @attr 2=102 is used in conjunction with a qualifier containing r=o/r=r, and Zebra isn’t capable of processing the @attr 2=102 relation attribute in conjunction with the @attr 4=109 structure attribute. Adam: Yep. The "local r=r or r=o" does not take precedence over the outer one. That's a bug in YAZ. It's been fixed and is part of next release of YAZ - version 5.15.0. I feel vindicated in that it was a bug as I suspected, although this fact doesn’t necessarily help us at the moment. The YAZ packaged with Wheezy is version 4.2.30… a long shot away from 5.15.0. Even on OpenSuse 13.2, I’m still only running YAZ 5.1.2. I’m optimistic about getting a newer version of YAZ into the OpenSuse repositories, as I was successful in getting them to package Zebra 2.0.60, but I suspect it will be difficult for Debian users since Debian hasn’t even acknowledged the issue raised by Robin in regards to updating Zebra to 2.0.60. I have to run at the moment, but just a FYI. I’ve asked Adam more specifically about relevance relation attributes and numeric, year, and date registers… hopefully he can provide some insight there as well… David Cook Systems Librarian Prosentient Systems 72/330 Wattle St, Ultimo, NSW 2007 From: koha-devel-bounces@lists.koha-community.org [mailto:koha-devel-bounces@lists.koha-community.org] On Behalf Of Barton Chittenden Sent: Friday, 6 November 2015 3:47 AM To: Koha-devel <koha-devel@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
The latest note on the matter… Barton, good work on highlighting this issue. It was indeed a bug in YAZ, and it’s one that Indexdata fixed just 35 hours ago: <http://git.indexdata.com/?p=yaz.git;a=commit;h=31596bdcae098f8acea695d44c44ee5f646b4c1f> http://git.indexdata.com/?p=yaz.git;a=commit;h=31596bdcae098f8acea695d44c44e... So version 5.15.0 is the latest version of YAZ. I haven’t actually tested the fix yet, but the key problem was with the 2=102 relevance relation attribute incorrectly overriding the relation attributes created by r=o/r=r in the CCL2RPN conversion. The error message that followed were due to the relevance 2=102 attribute being incompatible with numeric indexes. I talked to Adam Dickmeiss from Indexdata, and he said that relevance works with every query structure except 4=107 (zebra local number) and 4=109 (numeric strings/indexes). In those cases, he suggests using r=o/r=r, and if you look at ccl.properties… we indeed do add r=o for st-numeric… so that’s OK. He did suggest that he might add support for relevance on numeric indexes, but not sure about that one. Barton: I don’t think you’re going to be able to add lexile searching to the advanced search without making a workaround. After all, even with a new version of YAZ released, it’s not going to be available via any package managers yet… and it could break things for people with a version of YAZ less than 5.15.0… David Cook Systems Librarian Prosentient Systems 72/330 Wattle St, Ultimo, NSW 2007 From: koha-devel-bounces@lists.koha-community.org [mailto:koha-devel-bounces@lists.koha-community.org] On Behalf Of Barton Chittenden Sent: Friday, 6 November 2015 3:47 AM To: Koha-devel <koha-devel@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
Hopefully this will be my last email on the topic. As I mentioned before, YAZ 5.15.0 contains the CCL2RPN fix, which fixes the error that Barton was encountering during the search process outlined below. It might also be worth mentioning that Zebra 2.0.62 will contain a fix that allows 4=109 searches to use the 2=102 relevance attribute. This probably won’t affect us too much since st-numeric uses r=o, but it might be useful in cases where we’re searching for notforloan as that’s a CCL qualifier for 1=8008 4=109. With versions of Zebra prior to 2.0.62, doing a search for rk=(notforloan = 1) will result in a 117 error. The short-term fix would be to just add r=o to notforloan as well, but remembering to add r=o anytime you use 4=109 is prone to human error. Anyway, as I said above, hopefully that’s my last post about this topic, so I’ll stop spamming everyone ;). David Cook Systems Librarian Prosentient Systems 72/330 Wattle St, Ultimo, NSW 2007 From: koha-devel-bounces@lists.koha-community.org [mailto:koha-devel-bounces@lists.koha-community.org] On Behalf Of Barton Chittenden Sent: Friday, 6 November 2015 3:47 AM To: Koha-devel <koha-devel@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
participants (2)
-
Barton Chittenden -
David Cook