nyeholt / silverstripe-solr

SilverStripe and Solr integration ssaumodule
BSD 3-Clause "New" or "Revised" License
19 stars 18 forks source link

Unindexing of obsolete Doc does not work #50

Open johannesx75 opened 8 years ago

johannesx75 commented 8 years ago

In SolrResultSet::getDataObjects line 196 Objects that are in the Solr result, that are not found in the SilverStripe Database are supposed to be removed. But the call to SolrSearchService::unindex is wrong. unindex expects only one parameter $typeOrId.

We can't simply pass the $ID since unindex would prefix that with the RAW_DATA_KEY.

As a Hack I changed:

$this->solr->unindex($type, $id);

to

$removedObject = new $type;
$removedObject->ID = $id;
$this->solr->unindex($removedObject);

That seems to work. I could not test this with the current master branch, since we run on a fork from an older version. But from reading the code, I''m certain the problem still exists in the current version.