Is it possible to grouping data more than one field by using SolrTemplate
example, i want to group by id and name in a table
Is it possible to grouping data more than one field by using SolrTemplate
example, i want to group by id and name in a table
As the group options returns a list of group by fields you can probably do something like this:
Query query = new SimpleQuery(new SimpleStringCriteria("*:*"));
SimpleQuery groupQuery = new SimpleQuery(new SimpleStringCriteria("*:*"));
GroupOptions groupOptions = new GroupOptions()
.addGroupByField("id")
.addGroupByField("name")
.addGroupByQuery(query);
groupQuery.setGroupOptions(groupOptions);
GroupPage<Foo> page = solrTemplate.queryForGroupPage(query, Foo.class);
Read more in the docs here.