删除索引可以根据ID删除,也可以写一个查询条件,匹配到条件的都会被删除
@Test
public void deleteTest() throws SolrServerException, IOException {
// 连接solr服务器
HttpSolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr/core2");
// 删除索引
// solrServer.deleteById("6");
solrServer.deleteByQuery("title:金立");
// 提交
solrServer.commit();
}