I take it back. I didn't find it. I corrected my values and the facet queries still don't find what I want.
The values I'm looking for are URIs, so they look like: http://place.org/abc/def I add the facet query like so: query.addFacetQuery(MyField + ":" + "\"" + uri + "\""); I print the query, just to see what it is: Facet Query: MyField:" : http://place.org/abc/def" But when I examine queryResponse.getFacetFields, it's an empty list, if I do not set the facet field. If I set the facet field to MyField, then I get facets for ALL the values of MyField, not just the ones in the facet queries. Can anyone help here? Thanks. From: Simon, Richard T Sent: Wednesday, August 10, 2011 11:07 AM To: Simon, Richard T; solr-user@lucene.apache.org Subject: RE: Building a facet query in SolrJ Oops. I think I found it. My desiredFieldValues list has the wrong info. Knew there was something simple wrong. From: Simon, Richard T Sent: Wednesday, August 10, 2011 10:55 AM To: solr-user@lucene.apache.org Cc: Simon, Richard T Subject: Building a facet query in SolrJ Hi - I'm trying to do a (I think) simple facet query, but I'm not getting the results I expect. I have a field, MyField, and I want to get facets for specific values of that field. That is, I want a FacetField if MyField is "ABC", "DEF", etc. (a specific list of values), but not if MyField is any other value. If I build my query like this: SolrQuery query = new SolrQuery( luceneQueryStr ); query.setStart( request.getStartIndex() ); query.setRows( request.getMaxResults() ); query.setFacet(true); query.setFacetMinCount(1); query.addFacetField(MYFIELD); for (String fieldValue : desiredFieldValues) { query.addFacetQuery(MYFIELD + ":" + fieldValue); } queryResponse.getFacetFields returns facets for ALL values of MyField. I figured that was because setting the facet field with addFacetField caused Solr to examine all values. But, if I take out that line, then getFacetFields returns an empty list. I'm sure I'm doing something simple wrong, but I'm out of ideas right now. -Rich