开发solr功能问题点

Criteria criteria = new Criteria();

public Criteria and(Criteria criteria) {
this.criteriaChain.add(criteria);
return this;
}

public Criteria and(Criteria... criterias) {
this.criteriaChain.addAll(Arrays.asList(criterias));
return this;
}

这两个方法的区别是什么?

 

Map<String, String> map = new HashMap<String, String>();
map.put("q", "id:716669245129728 AND price:1000");

SolrParams solrParams = new MapSolrParams(map);
SolrServer solrServer = solrTemplate.getSolrServer();

QueryResponse queryResult = solrServer.query(solrParams);
SolrDocumentList solrList = queryResult.getResults();
System.out.println("result size-------------------" + solrList.size());

上面的AND 表示一起查询,id和price的查询条件都要满足

不能为小写,区分大小写

参考链接如下:

http://wiki.apache.org/solr/SolrQuerySyntax

posted @ 2015-01-06 16:16  唾手可得的树  阅读(226)  评论(0编辑  收藏  举报