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 Zisis Tachtsidis <zi...@runbox.com> on 2014/10/20 16:59:27 UTC

SolrCloud use of "min_rf" through SolrJ

Hi all,

I'm trying to make use of the "min_rf" (minimum replication factor) feature
described in https://issues.apache.org/jira/browse/SOLR-5468. According to
the ticket, all that is needed is to pass "min_rf" param into the update
request and get back the "rf" param from the response or even easier make
use of CloudSolrServer.getMinAchievedReplicationFactor().

I'm using SolrJ's CloudSolrServer but I couldn't find any way to pass
"min_rf" using the available add() methods when sending a document to Solr,
so I resorted to the following

UpdateRequest req = new UpdateRequest();
req.setParam(UpdateRequest.MIN_REPFACT, "1");
req.add(doc);
UpdateResponse response = req.process(cloudSolrServer);
int rf = cloudSolrServer.getMinAchievedReplicationFactor("collection_name",
response.getResponse());

Still the returned "rf" value is always -1. How can I utilize "min_rf"
through SolrJ?
I'm using Solr 4.10.0 with a collection that has 2 replicas (one leader, one
replica).

Thanks



--
View this message in context: http://lucene.472066.n3.nabble.com/SolrCloud-use-of-min-rf-through-SolrJ-tp4164966.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: SolrCloud use of "min_rf" through SolrJ

Posted by Zisis Tachtsidis <zi...@runbox.com>.
In case anyone else runs into this, I've managed to make it work. I didn't
notice in the ticket discussion that the specific feature is enabled when
min_rf >=2, I was setting min_rf=1. It goes without saying that you should
also have at least 2 replicas in your SolrCloud configuration. The actual
code I've used to make it return "rf" is

UpdateRequest req = new UpdateRequest();
req.setParam(UpdateRequest.MIN_REPFACT, "2");
req.add(doc);
NamedList response = solrServer.request(req);





--
View this message in context: http://lucene.472066.n3.nabble.com/SolrCloud-use-of-min-rf-through-SolrJ-tp4164966p4167250.html
Sent from the Solr - User mailing list archive at Nabble.com.