You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Will Milspec <wi...@gmail.com> on 2010/12/03 18:45:55 UTC

can solrj swap cores?

hi all,

Does solrj support "swapping cores"?

One of our developers had initially tried swapping solr cores (e.g. core0
and core1) using the solrj api, but it failed. (don't have the exact error)
He susequently replaced the call with straight http (i.e. http client).

Unfortunately I don't have the exact error in front of me...

Solrj code:

               CoreAdminRequest car = new CoreAdminRequest();
               car.setCoreName("production");
               car.setOtherCoreName("reindex");
               car.setAction(CoreAdminParams.CoreAdminAction.SWAP);

              SolrServer solrServer = SolrUtil.getSolrServer();
              car.process(solrServer);
              solrServer.commit();

Finally, can someone comment on the solrj javadoc on CoreAdminRequest:
 * This class is experimental and subject to change.

thanks,

will

Re: can solrj swap cores?

Posted by Tim Heckman <th...@gmail.com>.
It's been working for me. One thing to look out for might be the url
you're using in SolrUtil.getSolrServer()? The url you use for
reindexing won't be the same as the one you use to swap cores. Make
sure it's using "admin/cores" and not "production/admin/cores" or
"reindex/admin/cores".

Sorry if this is the obvious first thing you looked at already.  :)
It's the first thing that came to my mind.

Tim


On Fri, Dec 3, 2010 at 12:45 PM, Will Milspec <wi...@gmail.com> wrote:
> hi all,
>
> Does solrj support "swapping cores"?
>
> One of our developers had initially tried swapping solr cores (e.g. core0
> and core1) using the solrj api, but it failed. (don't have the exact error)
> He susequently replaced the call with straight http (i.e. http client).
>
> Unfortunately I don't have the exact error in front of me...
>
> Solrj code:
>
>               CoreAdminRequest car = new CoreAdminRequest();
>               car.setCoreName("production");
>               car.setOtherCoreName("reindex");
>               car.setAction(CoreAdminParams.CoreAdminAction.SWAP);
>
>              SolrServer solrServer = SolrUtil.getSolrServer();
>              car.process(solrServer);
>              solrServer.commit();
>
> Finally, can someone comment on the solrj javadoc on CoreAdminRequest:
>  * This class is experimental and subject to change.
>
> thanks,
>
> will
>

Re: can solrj swap cores?

Posted by Chris Hostetter <ho...@fucit.org>.
: One of our developers had initially tried swapping solr cores (e.g. core0
: and core1) using the solrj api, but it failed. (don't have the exact error)
: He susequently replaced the call with straight http (i.e. http client).
: 
: Unfortunately I don't have the exact error in front of me...

off the top of my head i can't think of any reason why it shouldn't work 
... w/ the details of hte error it's pretty much impossible for any one 
to offer you any assistance.

: Finally, can someone comment on the solrj javadoc on CoreAdminRequest:
:  * This class is experimental and subject to change.

it means that at the time the API was written, the contributor wasn't 
certain that it was the "correct" api for long term support, so they put 
that there as a CYA disclaimer in case future changes were needed in order 
to make hte API work properly.

in essence: while some APIs in Solr are very stable, and well supported, 
that one may change in future releases w/o a straight forward migration 
strategy if hte nature of the underlying functionalit (core 
administration) changes in some way that makes the current API unsuitable.

(regretable, we are not as good about auditing those types of disclaimers 
as we should be before/after releases) 

-Hoss