Solr 検索でドキュメントを取得し、同じ ID を持つ同じドキュメントを Solr に追加しようとしています。これを行うと、バージョンの競合が発生します。url
基本的に、以下のコードに示すようにリンクを追加しています。
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")
出力:
pysolr.SolrError: Solr responded with an error (HTTP 409): [Reason: version conflict for 1402196942545952769 expected=1703466479926640640 actual=1703528530413879296]