Hi

I user below code is right:
                SolrInputDocument doc1 = new SolrInputDocument();
                        doc1.addField("id", "1");
                        doc1.addField("name", "11s");
                        SolrInputDocument doc2 = new SolrInputDocument();
                        doc2.addField("id", "2");
                        doc2.addField("name", "22s");
                        SolrInputDocument doc3 = new SolrInputDocument();
                        doc3.addField("id", "3");
                        doc3.addField("name", "33s");
                        SolrInputDocument doc11 = new SolrInputDocument();
                        doc11.addField("id", "14");
                        doc11.addField("name", "44s");
                        Collection<SolrInputDocument> docs = new 
ArrayList<SolrInputDocument>();
                        docs.add(doc1);
                        solrServer.add(docs);
                        solrServer.optimize();
                        solrServer.commit();
                        docs.clear();
                        docs.add(doc2);
                        solrServer.add(docs);
                        solrServer.optimize();
                        solrServer.commit();
                        docs.clear();
                        docs.add(doc3);
                        solrServer.add(docs);
                        solrServer.optimize();
                        solrServer.commit();
                        docs.clear();
                        docs.add(doc11);
                        solrServer.add(docs);
                        solrServer.optimize();
                        solrServer.commit();


But use below code is not right:
                    SolrInputDocument doc1 = new SolrInputDocument();
                        doc1.addField("id", "1");
                        doc1.addField("name", "11s");
                        SolrInputDocument doc2 = new SolrInputDocument();
                        doc2.addField("id", "2");
                        doc2.addField("name", "22s");
                        SolrInputDocument doc3 = new SolrInputDocument();
                        doc3.addField("id", "3");
                        doc3.addField("name", "33s");
                        SolrInputDocument doc11 = new SolrInputDocument();
                        doc11.addField("id", "14");
                        doc11.addField("name", "44s");
                        Collection<SolrInputDocument> docs = new 
ArrayList<SolrInputDocument>();
                        docs.add(doc1);
                        docs.add(doc2);
                        docs.add(doc3);
                        docs.add(doc11);
                        solrServer.add(docs);
                        solrServer.optimize();
                        solrServer.commit();

I also see " Concerning CloudSolrServer, there is a JIRA to make it hash and 
send updates to the "right" leader, but currently it still doesn't - it just 
favors leaders in general over non leaders currently. " 

I wonder if one commit to only one leader, not every doc to different leaders 
according the shards.

Thanks!

-----邮件原件-----
发件人: Mark Miller [mailto:markrmil...@gmail.com] 
发送时间: 2013年2月21日 10:38
收件人: solr-user@lucene.apache.org
主题: Re: solr shards

Can you give some more details? When you look at the cloud tab of the admin UI, 
does the cluster visualization look right? Are all the nodes green? Perhaps the 
shard is a leader and a replica single shrad and you just think it's 2 shards?

- Mark

On Feb 20, 2013, at 8:26 PM, rulinma <ruli...@gmail.com> wrote:

> Hi
>   Use SolrCloud4.1 with one collection and 2 shards.
> 
>   I add 4 docs with id(1,2,3,4) set. I found that they appeard in 
> shard1 or
> shard2 together, not (1,3) in shard1 and (2,4) in shard2, I want to 
> know why? who can give me some advice.
> 
>  Thanks!
> 
> 
> 
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/solr-shards-tp4041704.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to