solr分组查询
package cn.sniper.solr.util;import java.io.IOException;import java.util.ArrayList;import java.util.Collection;import java.util.HashMap;import java.util.List;import java.util.Map;import java.util.Set;import java.util.TreeMap;import org.apache.commons.lang.StringUtils;import org.apache.log4j.Logger;import org.apache.solr.client.solrj.SolrQuery;import org.apache.solr.client.solrj.SolrServerException;import org.apache.solr.client.solrj.impl.HttpSolrServer;import org.apache.solr.client.solrj.impl.XMLResponseParser;import org.apache.solr.client.solrj.response.FacetField;import org.apache.solr.client.solrj.response.FacetField.Count;import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.common.SolrDocument;import org.apache.solr.common.SolrDocumentList;import org.apache.solr.common.SolrInputDocument;import cn.sniper.solr.model.Message;import cn.sniper.solr.model.Page;import cn.sniper.solr.model.PaginationVo;public class SolrUtil { public static final String URL = "http://localhost:8080/solr/collection1"; private static HttpSolrServer solrServer; public static final Logger logger = Logger.getLogger(SolrUtil.class); public static final String LOG_SEPARATOR = "#"; public static final String QUERY_KEYWORD = "QUERY_KEYWORD"; /** * 初始化 */ static { solrServer = new HttpSolrServer(URL); solrServer.setMaxRetries(1); // defaults to 0. > 1 not recommended. solrServer.setConnectionTimeout(5000); // 5 seconds to establish TCP // Setting the XML response parser is only required for cross // version compatibility and only when one side is 1.4.1 or // earlier and the other side is 3.1 or later. solrServer.setParser(new XMLResponseParser()); // binary parser is used by default // The following settings are provided here for completeness. // They will not normally be required, and should only be used // after consulting javadocs to know whether they are truly required. solrServer.setSoTimeout(1000); // socket read timeout solrServer.setDefaultMaxConnectionsPerHost(1000); solrServer.setMaxTotalConnections(1000); solrServer.setFollowRedirects(false); // defaults to false // allowCompression defaults to false. // Server side must support gzip or deflate for this to have any effect. solrServer.setAllowCompression(true); } /** * 批量添加 * @param list */ public static void addList(List