Another technique, which works great for facet fq's and avoids the need
to worry about escaping, is using the "field" query parser instead:
fq={!field f=Product}Electric Guitar
Using the "field" query parser avoids the need for ANY escaping of your
value at all, which is convenient in the facetting case -- you still
need to URI-escape (ampersands for instance), but you shouldn't need to
escape any Solr special characters like parens or double quotes or
anything else, if you've made your string suitable for including in a
URI. With the "field" query parser, a lot less to worry about.
http://lucene.apache.org/solr/api/org/apache/solr/search/FieldQParserPlugin.html
On 12/22/2010 9:53 AM, Dyer, James wrote:
The phrase solution works as does escaping the space with a backslash:
fq=Product:Electric\ Guitar ... actually a lot of characters need to be escaped
like this (amperstands and parenthesis come to mind)...
I assume you already have this indexed as "string", not "text"...
James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311
-----Original Message-----
From: Andy [mailto:angelf...@yahoo.com]
Sent: Wednesday, December 22, 2010 1:11 AM
To: solr-user@lucene.apache.org
Subject: White space in facet values
How do I handle facet values that contain whitespace? Say I have a field "Product" that I want to facet on. A
value for "Product" could be "Electric Guitar". How should I handle the white space in
"Electric Guitar" during indexing? What about when I apply the constraint fq=Product:Electric Guitar?