Not under shell I want to call the optimize use Java code and get returned when the optimize process is finished.
A:
Just fire a request to /solr/update?optimize=true
from anywhere/anything that has access to the Solr server, e.g:
curl 'http://localhost:8983/solr/update?optimize=true'
Mauricio Scheffer
2010-09-19 13:38:08
+1
A:
Using solrj, you call the optimize method of the class CommonsHttpSolrServer.
See this question about how to know when the optimize is done.
Pascal Dimassimo
2010-09-19 14:56:03
A:
Can you be little more specific about your requirement,anyway Here is how i optimize the solr using solrj EmbeddedSolrServer,
SolrServer server = CacheServer.getCacheInstance().getServer();
try {
server.optimize();
} catch (SolrServerException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
For more details about optimize
Natsabari
2010-09-20 10:33:59