update: Pysolr Version: 3.2.0
This seems a bug in solr. when update nothing in an operation, it will delete this doc.
Former I used code in using pysolr in atomic update, but I made error in following case.
Now a document schema maybe like this:
doc = {
'id': ...,
'title': ...,
'body': ...,
}
I have indexed a batch of docs and now I want to update every doc with a new field anchor_text. Here is my code:
solr = pysolr.Solr(url_solr)
doc_update = {
'id': ...,
'anchor_text': [a,b,c,...]
}
solr.add([doc_update], fieldUpdates={
'anchor_text': 'set'
})
But I found some of original docs were removed only with id field left. Something like this after update:
doc = {
'id':...
}
Especially, for those whose anchor_text field are empty lists, the original docs are removed. While others are not.(Probably I guess because I only see several cases).
I've looked at the source code but found nothing valuable. What's going on here?
What are the correct way to use pysolr in update document?