[Koha-bugs] [Bug 15745] C4::Matcher gets CCL parsing error if term contains ? (question mark)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sun Feb 14 23:50:12 CET 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15745

--- Comment #4 from David Cook <dcook at prosentient.com.au> ---
(In reply to M. Tompsett from comment #3)
> What about the test case where you want to search for double quotes?
> Escaping is needed. Perhaps there is another way?

I disagree. Why do you think escaping is needed? Can you point me to the
particular test case or query in mind?

Firstly, the values are coming from the MARC record, so I doubt there will be
many double quotes in that data. 

Secondly, even if there are double quotes in the data, CCL2RPN takes them into
account. We can see what happens if we double up our double quotes on the
front/back of the query:

Z> find id-other,st-urx="http://libris.kb.se/resource/bib/219553"
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 11, setno 31
SearchResult-1: term=http://libris.kb.se/resource/bib/219553 cnt=11
records returned: 0
Elapsed: 0.000886

BECOMES: @attrset Bib-1 @attr 1=9012 @attr 4=104
http://libris.kb.se/resource/bib/219553

Z> find id-other,st-urx=""http://libris.kb.se/resource/bib/219553""
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 11, setno 32
SearchResult-1: term=http://libris.kb.se/resource/bib/219553 cnt=11
records returned: 0
Elapsed: 0.000792

BECOMES: @attrset Bib-1 @attr 1=9012 @attr 4=104
http://libris.kb.se/resource/bib/219553

Z> f ti,phr=""This is a test""
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 4, setno 33
SearchResult-1: term=This cnt=4, term=is cnt=4, term=a cnt=4, term=test cnt=4
records returned: 0
Elapsed: 0.001079

BECOMES: @attrset Bib-1 @attr 1=4 @attr 4=1 "This is a test"

Z> f ti,phr="This is a test"
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 4, setno 34
SearchResult-1: term=This cnt=4, term=is cnt=4, term=a cnt=4, term=test cnt=4
records returned: 0
Elapsed: 0.000961

BECOMES: @attrset Bib-1 @attr 1=4 @attr 4=1 "This is a test"

--

I'm guessing you're referring to a case where the data contains a double quote
and you're searching to match a double quote... but Zebra should strip out
double quotes during indexing in most cases. It might not for URLs, but RFC3986
stipulates that you should be percent encoding double quotes as %22 anyway so
that shouldn't be an issue. 

I'll look at an example of that in a moment...

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list