SolrServer
SolrServer是一个抽象类,主要要的实现类有CommonsHttpSolrServer、HttpSolrServer、ConcurrentUpdateSolrServer等,SolrServer类主要用于对索引的创建、添加、删除、修改、查询,因此对于索引的所有操作都是交给SolrServer来完成。CommonsHttpSolrServer类是在Solrj3.5版本之前的(包括3.5版本),而HttpSolrServer是在3.5版本之后的,我们主要以HttpSolrServer为主。其基本用法如下:
1. 构造方法
public HttpSolrServer(String URL)
public HttpSolrServer(String URL,HttpClient client)
这里的URL代表我们的地址、client代表客户端,我们通常使用的是第一种构造方法。
2. 添加索引操作
public UpdateResponse add(SolrInputDocument doc)
pub