solrTemplate.saveBean(new ExampleSolrBean("id_4", "name2", "category2", 1, false));
solrTemplate.saveBean(new ExampleSolrBean("id_5", "name2", "category2", 2, false));
solrTemplate.saveBean(new ExampleSolrBean("id_6", "name2", "category1", 1, true));
solrTemplate.commit();
SimpleFacetQuery groupQuery = new SimpleFacetQuery(new SimpleStringCriteria("*:*"));
GroupOptions groupOptions = new GroupOptions();
groupQuery.setGroupOptions(groupOptions);
groupQuery.setFacetOptions(new FacetOptions("inStock"));
groupOptions.addGroupByField("name");
groupOptions.setGroupFacets(true);
FacetPage<ExampleSolrBean> groupResultPage = solrTemplate.queryForFacetPage(groupQuery, ExampleSolrBean.class);
Page<FacetFieldEntry> facetResultPage = groupResultPage.getFacetResultPage("inStock");