When the user creates a document, I add the date to the solr index. Every time the data changes like edit or delete, do I have to reindex the whole data?
What does reindex mean in that case? When I do
$this->indexData(array(
'id' => $pid,
'title' => $data['titel']
));
for each document and do $solr->addDocuments
, does it just overwrite already existing data?
I tried to reindex the whole index on add/delete/edit but after I delete a certain field its information still seems to be in the index.
Any ideas?
When you index a document to solr, it will overwrite any existing document with the same <uniqueKey/>
which is usually the id. So yes, it overwrites existing data.
When you want to change a single field of a document you will have to reindex the whole document, as solr does not support updating of a field only. So, when you delete a field, you will have to reindex the document without the field. This will overwrite the existing data. Dont forget to send a commit
at the end.
With Solr 4 you can update a single field of a document. See Atomic_Updates
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With