1

I am new to apache solr.
I want to manipulate the multicore dynamically using CoreAdminHandler class of
org.apache.solr.handler.admin.CoreAdminHandler;

There are no tutorials on how to use it nor any good example I could google out.
Please give me some example of how can I manipulate multicore which are deployed in tomcat(not embedded) using CoreAdminHandler and solrj.
How can I specify the path of my tomcat server where solr is deployed for CoreAdminHandler/coreContainer.
And how to specify the path where multicores are placed?

veer7
  • 20,074
  • 9
  • 46
  • 74
  • http://stackoverflow.com/a/10043721/1356127 This post gave me some idea of creating server then using it for CoreAdmin Request and Responses I am still searching for link where I can see more about CoreAdminHandler activities like using CREATE, SWAP, LOAD etc – veer7 May 22 '12 at 07:45

1 Answers1

5

Here is an example you can use to get the list of the available cores through a status request:

CoreAdminRequest adminRequest = new CoreAdminRequest();
adminRequest.setAction(CoreAdminAction.STATUS);
CoreAdminResponse adminResponse = adminRequest.process(new CommonsHttpSolrServer(solrUrl));
NamedList<NamedList<Object>> coreStatus = adminResponse.getCoreStatus();

The following are the available CoreAdmin actions you can use:

STATUS,  
LOAD,
UNLOAD,
RELOAD,
CREATE,
PERSIST,
SWAP,
RENAME,
@Deprecated
ALIAS,
MERGEINDEXES;

The code you can use is pretty much the same, you just have to pick the right action and correctly read the results within the returned NamedList object. Let me know if you have some more specific question.

javanna
  • 59,145
  • 14
  • 144
  • 125
  • Thank you @javanna. That works...Ok I'll ask the other question with new thread and will provide link here so that you can help me – veer7 May 22 '12 at 09:47
  • here is a new thread where you can help me about solr http://stackoverflow.com/questions/10716690/which-jars-are-needed-to-use-concurrentupdatesolrserver – veer7 May 23 '12 at 09:20