没有账号密码时是这样连接的:
public void addIndex() throws SolrServerException, IOException{
//1.连接solr
String baseURL="http://localhost:8080/solr/new_core";
HttpSolrClient server=new HttpSolrClient(baseURL);
//2创建索引库
SolrInputDocument document = new SolrInputDocument();
//3.添加信息
document.addField("id", "3333");
document.addField("userName", "王位军");
//把信息添加到索引库中
server.add(document);
//提交事务
server.commit();
}
有了后该如何操作,求大神帮解答一下
public void addIndex() throws SolrServerException, IOException{
//1.连接solr
String baseURL="http://localhost:8080/solr/new_core";
HttpSolrClient server=new HttpSolrClient(baseURL);
//2创建索引库
SolrInputDocument document = new SolrInputDocument();
//3.添加信息
document.addField("id", "3333");
document.addField("userName", "王位军");
//把信息添加到索引库中
server.add(document);
//提交事务
server.commit();
}
有了后该如何操作,求大神帮解答一下