lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shalin Shekhar Mangar <shalinman...@gmail.com>
Subject Re: Query regarding Solr doc atomic updates
Date Mon, 04 Aug 2014 09:37:36 GMT
I think you are sending the entire document returned by Solr again for an
atomic update. The reason why it fails with a version conflict error
because the document you are sending has a _version_ field.

Just send the unique key and the field that you want to update. The rest of
the fields aren't required (they're looked up internally by Solr).


On Mon, Aug 4, 2014 at 2:05 PM, M, Arjun (NSN - IN/Bangalore) <
arjun.m@nsn.com> wrote:

> Hi Shalin,
>
>         Thanks for the response.. :)
>
>         In this case, is there any other way to update the document make
> it the retrieval work?
>
>         I tried the below code and with this I am getting the version
> conflict exception. How to avoid this and make it work?
>
>         SolrInputDocument upd = ClientUtils.toSolrInputDocument(moDoc);
>         partialUpdate.put("set", location);
>         upd.addField(SolrSchemaColumns.Location, partialUpdate);
>         solrBatchUpdater.addDocument(upd);
>
>         Exception :
>         ============
>
>         Caused by:
> org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
> version conflict for id expected=1475490874414596096
> actual=1475490876226535424
>         at
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:495)
> ~[solr-solrj-4.7.0.jar:4.7.0 1570806 - simon - 2014-02-22 08:36:25]
>         at
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:199)
> ~[solr-solrj-4.7.0.jar:4.7.0 1570806 - simon - 2014-02-22 08:36:25]
>         at
> org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
> ~[solr-solrj-4.7.0.jar:4.7.0 1570806 - simon - 2014-02-22 08:36:25]
>         at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:68)
> ~[solr-solrj-4.7.0.jar:4.7.0 1570806 - simon - 2014-02-22 08:36:25]
>         at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)
> ~[solr-solrj-4.7.0.jar:4.7.0 1570806 - simon - 2014-02-22 08:36:25]
>
>
> Thanks & Regards,
>         Arjun M
>
>
> -----Original Message-----
> From: ext Shalin Shekhar Mangar [mailto:shalinmangar@gmail.com]
> Sent: Monday, August 04, 2014 11:08 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Query regarding Solr doc atomic updates
>
> In order for Atomic Updates to work, all your fields must be stored in the
> index. In this case, ClusterId is not stored and is therefore lost on an
> atomic update.
>
> --
> Regards,
> Shalin Shekhar Mangar.
>
>
> On Mon, Aug 4, 2014 at 11:00 AM, M, Arjun (NSN - IN/Bangalore) <
> arjun.m@nsn.com> wrote:
>
> > Hi,
> >
> >         I have a field in my solr schema as below.
> >
> >         <field name="ClusterId" indexed="true" type="string"
> > stored="false" required="false" />
> >
> >         After updating some docs via SolrInputDocument, I am not able to
> > query the updated docs with ClusterId field i.e., when I query using
> > ClusterId the updated docs are not being retrieved. Can you please help
> > here?
> >
> >
> > Thanks & Regards,
> >         Arjun M
> >
> >
> >
> >
> >
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>



-- 
Regards,
Shalin Shekhar Mangar.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message