Reputation: 810
I'm trying to filter with fq
for fields having special characters, particularly parentheses. For example, given the document:
<result name="response" numFound="1" start="0">
<doc>
<arr name="town_snc">
<str>Hartford (Connecticut)</str>
</arr>
</doc>
</result>
I want to do e.g. ?fq:town_snc=Hartford (Connecticut)
I'm not getting any results; I presume that the parentheses need to be escaped, but I was not able to find the escaping method.
Thank you!
Upvotes: 6
Views: 7319
Reputation: 2391
Using the "field" qparser allows you to not have to do any escaping:
fq={!field f=town_snc}Hartford (Connecticut)
Or you can use the normal lucene query parser and use double quotes (but then you must still escape some things like quotes)
fq=town_snc:"Hartford (Connecticut)"
Or you could use backslash escaping too (just remember to also escape the space).
http://wiki.apache.org/solr/SolrQuerySyntax
Upvotes: 14