StringFieldFacetQueryConverter extends AbstractConverterAware<String, SimpleFacetQuery> { @Override public SimpleFacetQuery convert(String fieldName) { Criteria criteria = new SimpleStringCriteria("*:*"); SimpleFacetQuery facetQuery = new SimpleFacetQuery(); facetQuery.addCriteria(criteria); facetQuery.setRows(0); FacetOptions facetOptions = new FacetOptions(); facetOptions.setFacetMinCount(1); facetOptions.addFacetOnField(fieldName); facetOptions.setFacetLimit(-1); facetQuery.setFacetOptions(facetOptions); return facetQuery; }  @Override SimpleFacetQuery convert(String fieldName);  }
@Test public void testConvert() { String field = "myfield"; SimpleQuery simpleQuery = underTest.convert(field); SolrQuery queryResult = new DefaultQueryParser().doConstructSolrQuery(simpleQuery); assertEquals("?q=*%3A*&rows=0&facet=true&facet.mincount=1&facet.limit=-1&facet.field=myfield", queryResult.toQueryString()); }