Sometimes you want to delete all the records from the Solr index without deleting the index directory.
This can be done by executing an http url :-
1 |
http://host:port/solr/core/update?stream.body=*:*&commit=true<br /></code><br /> |
Or by posting data xml data :-
1 |
*:* |
Cleaning data using Solrj :-
1 |
SolrServer server = null;<br />try {<br /> server = new CommonsHttpSolrServer(masterIndexUrl);<br /> server.deleteByQuery("*:*");<br /> server.commit(true, true);<br /> server.optimize(true, true); <br />} catch (Exception e) {<br /> try {<br /> server.rollback(); <br /> } catch (Exception e1) {<br /> <br /> }<br />}<br /> |