RE: SolrJ and Multi Core Set up
Not sure about SolrJ, but generally in multi core Solr your core has a name and a data dir which don't have to be the same. In your case, you could have 2 cores called "live" and "rebuild" which reside on 2 data dirs called "core0" and "core1". You would always access the cores by their names, and when you swap them your "rebuild" would become your "live". Whenever you swap them a different one will point to the same data dir "core0", but you won't really care which one points where. Ephraim Ofir -Original Message- From: Shaun Campbell [mailto:campbell.sh...@gmail.com] Sent: Friday, September 03, 2010 2:41 PM To: solr-user@lucene.apache.org Subject: Re: SolrJ and Multi Core Set up Thanks Chantal I hadn't spotted that that's a big help. Thank you. Shaun On 3 September 2010 12:31, Chantal Ackermann < chantal.ackerm...@btelligent.de> wrote: > 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 > > > >
Re: SolrJ and Multi Core Set up
Thanks Chantal I hadn't spotted that that's a big help. Thank you. Shaun On 3 September 2010 12:31, Chantal Ackermann < chantal.ackerm...@btelligent.de> wrote: > 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 > > > >
Re: SolrJ and Multi Core Set up
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
SolrJ and Multi Core Set up
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