Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quotation marks need to be escaped in Solr facet queries #17

Closed
ksclarke opened this issue Apr 18, 2012 · 5 comments
Closed

Quotation marks need to be escaped in Solr facet queries #17

ksclarke opened this issue Apr 18, 2012 · 5 comments
Assignees
Milestone

Comments

@ksclarke
Copy link

Current facet link produces something like 39_s:"Smythe,%20William%20"Bill"" (when the thing being faceted has quotes in it).

It should be encoded to something like 39_s:"Smythe,%20William%20%5C"Bill%5C"" (where the quotes are escaped by a backslash).

The first will return zero hits while the second will return the correct number of hits.

@ksclarke
Copy link
Author

Oops, think I commented in the wrong place; posting here too:

This did not fix the problem. The " needs to be escaped for Solr as " -- this is different from html encoding

See http://lucene.apache.org/core/3_6_0/queryparsersyntax.html#Escaping%20Special%20Characters for more details

Also, the isset() replaced the !empty() -- there are cases where $current['facet'] is empty but set. isset() breaks but !empty() catches both cases.

@ksclarke
Copy link
Author

Oh, sorry... see the isset() !empty() issue is filed on another ticket (which is still open)

@waynegraham waynegraham reopened this Apr 21, 2012
@waynegraham
Copy link

Need to test to see if mysql_real_escape_string has side effects for this; otherwise a quick preg_replace should work...

@waynegraham
Copy link

Looking a bit more, Apache_Solr_Service::escape() may be what is needed.

@erochest
Copy link
Contributor

Apache_Solr_Service::escape seemed to introduce extra back-slashes. I may track this down later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants