I'm trying to filter with fq
for fields having special characters, particularly parentheses. For exam开发者_StackOverflow社区ple, 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!
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
精彩评论