刪除索引可以根據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();
}