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