Re: Swapping cores with SolrJ

2010-09-14 Thread Shaun Campbell
Hi Mitch

Thanks for responding.  Not actually sure what you wanted from
CoreAdminResponse but I put the following in:

CoreAdminRequest car = new CoreAdminRequest();
car.setCoreName("live");
car.setOtherCoreName("rebuild");
car.setAction(CoreAdminParams.CoreAdminAction.SWAP);
CoreAdminResponse carp = car.process(solrServer);
logger.debug("CoreAdminResponse status : " +
carp.getCoreStatus());
logger.debug("CoreAdminResponse : " +
carp.getResponse().toString());

and this was the output:

DEBUG: uk.co.apps2net.intranet.service.SolrServiceImpl - CoreAdminResponse
status : null
DEBUG: uk.co.apps2net.intranet.service.SolrServiceImpl - CoreAdminResponse :
{responseHeader={status=0,QTime=31}}

Looks sort of as though it's done nothing!!

Thanks
Shaun



On 14 September 2010 15:49, MitchK  wrote:

>
> Hi Shaun,
>
> I think it is more easy to fix this problem, if we got more information
> about what is going on in your application.
> Please, could you provide the CoreAdminResponse returned by car.process()
> for us?
>
> Kind regards,
> - Mitch
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Swapping-cores-with-SolrJ-tp1472154p1473435.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Swapping cores with SolrJ

2010-09-14 Thread MitchK

Hi Shaun,

I think it is more easy to fix this problem, if we got more information
about what is going on in your application.
Please, could you provide the CoreAdminResponse returned by car.process()
for us?

Kind regards,
- Mitch
-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/Swapping-cores-with-SolrJ-tp1472154p1473435.html
Sent from the Solr - User mailing list archive at Nabble.com.


Swapping cores with SolrJ

2010-09-14 Thread Shaun Campbell
I've got Solr set up now with two cores which I call live and rebuild and
which point to core0 and core1 directories respectively.  My solr.xml file
contains:

  


  

In my Spring MVC application I have Solr set up as an embedded server and
have two singleton beans which I use to refer to the live server and the
rebuild server.  That all seems to work fine. I have a Java rebuild method
which I use to load up the rebuild core with data.  At the end of this
method I am attempting to switch the cores around so that the main
application can still keep using the live core and automatically pick up the
new data.  Unfortunately, it doesn't appear to be swapping, or rather it
does sometimes but I can't see why.

My swapping code is:

// Swap the cores
CoreAdminRequest car = new CoreAdminRequest();
car.setCoreName("live");
car.setOtherCoreName("rebuild");
car.setAction(CoreAdminParams.CoreAdminAction.SWAP);
car.process(solrServer);
solrServer.commit();

The solrServer variable would be pointing to my rebuild core that I have
just updated. I see that index files in core1 get updated.  And I've also
see that the index files in core0 have been updated at some time earlier in
the day due to timestamps.

I haven't been able to see a working example of swapping cores via Java so I
wondered whether I was doing it wrong or missing out an important step, or
perhaps I've got completely the wrong end of the stick and looking at the
timestamps on my files is not correct.  Regardless of this what I can see in
my application though is that searches that constantly look to the live core
return the same data so the swapping doesn't seem to take place.

Thanks in advance for any tips.
Shaun