pysolr.SolrError: Solr responded with an error (HTTP 409): [Reason: version conflict for expected= actual=]

413 Views Asked by At

I am trying to retrieve the documents with a Solr search and then try to add that same document with that same id back into Solr. In doing this, I get a version conflict. Basically i am adding url link as shown in the code below.

solr = pysolr.Solr('http://**** ', timeout=10)
results = solr.search('resourceType:abc', rows=10)

for res in results:
    if 'url' not in res:
        print("adding...........")
        print(res['id'])
        link = 'https://twitter.com/twitter/statuses/' + res['id']
        res['url'] = link
        solr.add(res)
        print(link)
    else:
        print("no need to add")

OUTPUT:

pysolr.SolrError: Solr responded with an error (HTTP 409): [Reason: version conflict for 1402196942545952769 expected=1703466479926640640 actual=1703528530413879296]
0

There are 0 best solutions below