Commit 47e76ac2 authored by Bert Balcaen's avatar Bert Balcaen
Browse files

Converting empty values to 'null' before sending them to Solr.

parent 24401847
......@@ -18,7 +18,18 @@ class SolrEngine extends Engine
{
$update = \Solr::createUpdate();
$models->each(function ($model) use (&$update) {
$document = $update->createDocument($model->toSearchableArray());
$searchableArray = $model->toSearchableArray();
foreach ($searchableArray as $key => $value) {
if (empty($value)) {
if (is_string($value)) {
$value = 'null';
} else if (is_array($value)) {
$value = ['null'];
}
$searchableArray[$key] = $value;
}
}
$document = $update->createDocument();
$update->addDocument($document);
});
$this->executeStatement($update);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment