When you call addFacetField, the parameter you pass it should just be the fieldName. The fieldValue shouldn't come into play at all (unless I'm misunderstanding what you're trying to do).
If you ever do need to escape a value for a query, you can use org.apache.solr.client.solrj.util.ClientUtils.escapeQueryChars(). -Michael -----Original Message----- From: tedsolr [mailto:tsm...@sciquest.com] Sent: Wednesday, October 01, 2014 5:33 PM To: solr-user@lucene.apache.org Subject: Exact match on string field with special characters I am trying to do SQL like aggregation (GROUP BY) with solr faceting. So I use string fields for faceting - to try to get an exact match. However, it seems like to run a facet query I have to surround the value with double quotes. That poses issues when the field value is green "bath" towels -or- red \cars Those two special characters must be transformed somehow on indexing so I can create the query: (java) ... String fg = fieldName + ":\"" + fieldValue + "\""; query.addFacetField(fq); ... Is there a way to request an exact match search without having to resort to the quotes? I could possibly convert spaces to underscores at index time, but I'd like to avoid munging that data because I'm using the string field for display too! That saves time/searches when aggregating against 10 - 15 fields which takes a whole lot of facet searches to begin with. Using Solr 4.9 -- View this message in context: http://lucene.472066.n3.nabble.com/Exact-match-on-string-field-with-special-characters-tp4162209.html Sent from the Solr - User mailing list archive at Nabble.com.