logger.debug(solrQuery.toQueryString()); final QueryResponse response = req.process(getSolrClient()); final SolrDocumentList documentList = response.getResults();
/** * @param query the {@link SolrQuery} * @param consumer how to handle the results * @param groupingField the name of the field to group with * @param groupLimit the number of results per group */ public void group(SolrQuery query, Consumer<GroupCommand> consumer, String groupingField, int groupLimit) { if (query == null) throw new NullPointerException("Search query is null"); if (groupingField == null) throw new NullPointerException("Grouping field is null"); LOGGER.info("query {}", query.toQueryString()); query.setRows(this._row); query.setStart(this._start); // grouping query.setParam("group", true); //the number of groups that matches the the query query.setParam("group.ngroups", true); // the grouping field query.setParam("group.field", groupingField); // number of group limit query.setParam("group.limit", String.valueOf(groupLimit)); QueryResponse response = this._solr.query(query); if (response != null) { LOGGER.info("response size {}", response.getResponse().size()); GroupResponse groupResponse = response.getGroupResponse(); groupResponse.getValues().forEach(consumer); } }
LOGGER.info("query {}", query.toQueryString()); return this._solr.query(query);
logger.debug(solrQuery.toQueryString()); final QueryResponse response = req.process(getSolrClient()); final SolrDocumentList documentList = response.getResults();
LOGGER.info("query {}", query.toQueryString()); QueryResponse response = this._solr.query(query);