好贷网好贷款

solr-group by

发布时间:2016-12-5 22:38:36 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"solr-group by",主要涉及到solr-group by方面的内容,对于solr-group by感兴趣的同学可以参考一下。

solr group by查询: 1.solr wiki参考:[url]http://wiki.apache.org/solr/FieldCollapsing[/url 2.solrj group查询例子: SolrQuery SolrQuery = new SolrQuery("*:*"); solrQuery.addFilterQuery("display:1"); solrQuery.addFilterQuery("activityBeginTime:[* TO NOW]"); solrQuery.addFilterQuery("activityEndTime:[NOW TO *]"); solrQuery.setGroup(true); solrQuery.setParam(GroupParams.GROUP_QUERY, {"id:1","id:2"}); solrQuery.setParam(GroupParams.GROUP_LIMIT, pageSize + ""); solrQuery.setParam(GroupParams.GROUP_OFFSET, pageSize * (page - 1) + ""); solrQuery.setParam(GroupParams.GROUP_LIMIT, "1"); solrQuery.setParam(GroupParams.GROUP_SORT, "id desc", "sort asc"); solrQuery.setRows(0); QueryResponse qr = searchSource.query(searchQuery, SolrRequest.METHOD.POST); GroupResponse groupResponse = qr.getGroupResponse(); List<GroupCommand> list = groupResponse.getValues(); for (GroupCommand gc : list) { List<Group> gs = gc.getValues(); if (CollectionUtils.isNotEmpty(gs)) { for (Group g : gs) { SolrDocumentList sds = g.getResult(); if (CollectionUtils.isNotEmpty(sds)) { for (SolrDocument doc : sds) { String id= doc.getFieldValue("id").toString(); } } } } } }

上一篇:solr-solr参数,配置
下一篇:Linux设备模型(总线、设备、驱动程序和类)

相关文章

关键词: solr-group by

相关评论