其代码:
solrServer.deleteById("2");
solrServer.commit();
程序一运行到红色部分,就报错其错误提示是:
org.apache.solr.common.SolrException: Not Found
Not Found
request: http://localhost:8080/solr/core1/update/javabin?wt=javabin&version=1
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:435)
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:244)
at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:105)
at org.apache.solr.client.solrj.SolrServer.deleteById(SolrServer.java:102)
at com.test.solr.SolrDelList.main(SolrDelList.java:37)
请问下,这是什么错误哦?
------解决方案--------------------------------------------------------
你应该捕一下异常
------解决方案--------------------------------------------------------
例如:schema.xml中配置的<uniqueKey>id</uniqueKey>
solrServer.deleteById("id:2");
solrServer.commit();
再试试。