Thanks ryantxu for your answer. I implement the interface and it returns me the current core. But how is it different from doing request.getCore() from handleRequestBody()? And I don't see how this can give me access to other cores. I think that what I need is to get access to an instance of CoreContainer, so I can call getCore(name) and getAdminCore to manage the different cores. So I'm wondering if this is a good way to get that instance:
CoreContainer.Initializer initializer = new CoreContainer.Initializer(); CoreContainer cores = initializer.initialize(); ryantxu wrote: > > If you are doing this in a RequestHandler, implement SolrCoreAware and > you will get a callback with the Core > > http://wiki.apache.org/solr/SolrPlugins#head-8b3ac1fc3584fe1e822924b98af23d72b02ab134 > > > On Mar 12, 2009, at 3:04 PM, Pascal Dimassimo wrote: > >> >> I found this code to access other core from my custom requesthandler: >> >> CoreContainer.Initializer initializer = new >> CoreContainer.Initializer(); >> CoreContainer cores = initializer.initialize(); >> SolrCore otherCore = cores.getCore("otherCore"); >> >> It seems to work with some little testing. But is it a recommended >> approach? >> >> >> Pascal Dimassimo wrote: >>> >>> Hi, >>> >>> I've designed a "front" handler that will send request to other >>> handlers >>> and return a aggregated response. >>> >>> Inside this handler, I call other handlers like this (inside the >>> method >>> handleRequestBody): >>> >>> SolrCore core = req.getCore(); >>> SolrRequestHandler mlt = core.getRequestHandler("/mlt"); >>> ModifiableSolrParams params = new >>> ModifiableSolrParams(req.getParams()); >>> params.set("mlt.fl", "nFullText"); >>> req.setParams(params); >>> mlt.handleRequest(req, rsp); >>> >>> First question: is this the recommended way to call another handler? >>> Second question: how could I call a handler of another core? >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Programmatic-access-to-other-handlers-tp22477731p22483357.html >> Sent from the Solr - User mailing list archive at Nabble.com. >> > > > -- View this message in context: http://www.nabble.com/Programmatic-access-to-other-handlers-tp22477731p22486235.html Sent from the Solr - User mailing list archive at Nabble.com.