Hi Shaun, you create the SolrServer using multicore by just adding the core to the URL. You don't need to add anything with SolrQuery.
URL url = new URL(new URL(solrBaseUrl), coreName); CommonsHttpSolrServer server = new CommonsHttpSolrServer(url); Concerning the "default" core thing - I wouldn't know about that. Cheers, Chantal On Fri, 2010-09-03 at 12:03 +0200, Shaun Campbell wrote: > I'm writing a client using SolrJ and was wondering how to handle a multi > core installation. We want to use the facility to rebuild the index on one > of the cores at a scheduled time and then use the SWAP facility to switch > the "live" core to the newly rebuilt core. I think I can do the SWAP with > CoreAdminRequest.setAction() with a suitable parameter. > > First of all, does Solr have some concept of a default core? If I have core0 > as my "live" core and core1 which I rebuild, then after the swap I expect > core0 to now contain my rebuilt index and core1 to contain the old live core > data. My application should then need to keep referring to core0 as normal > with no change. Does I have to refer to core0 programmatically? I've > currently got working client code to index and to query my Solr data but I > was wondering whether or how I set the core when I move to multi core? > There's examples showing it set as part of the URL so my guess it's done by > using something like setParam on SolrQuery. > > Has anyone got any advice or examples of using SolrJ in a multi core > installation? > > Regards > Shaun