Skip to content
Snippets Groups Projects
Commit 71884204 authored by André Lahmann's avatar André Lahmann Committed by Demian Katz
Browse files

Sharding fixes

* replaced not_null check of initialized array in VuFind\Search\Solr\Params
* eliminated warning/added comments in VuFind\Search\Solr\MultiIndexListener
parent 1e341e4c
No related merge requests found
...@@ -124,7 +124,14 @@ class MultiIndexListener ...@@ -124,7 +124,14 @@ class MultiIndexListener
} else { } else {
// In any other context, we should make sure our field values are // In any other context, we should make sure our field values are
// all legal. // all legal.
$shards = explode(',', implode(',', $params->get('shards')));
// Normalize array of strings containing comma-separated values to
// simple array of values; check if $params->get('shards') returns
// an array to prevent invalid argument warnings.
$shards = $params->get('shards');
$shards = explode(
',', implode(',', (is_array($shards) ? $shards : array()))
);
$fields = $this->getFields($shards); $fields = $this->getFields($shards);
$specs = $this->getSearchSpecs($fields); $specs = $this->getSearchSpecs($fields);
$backend->getQueryBuilder()->setSpecs($specs); $backend->getQueryBuilder()->setSpecs($specs);
......
...@@ -459,7 +459,7 @@ class Params extends \VuFind\Search\Base\Params ...@@ -459,7 +459,7 @@ class Params extends \VuFind\Search\Base\Params
// Shards // Shards
$allShards = $this->getOptions()->getShards(); $allShards = $this->getOptions()->getShards();
$shards = $this->getSelectedShards(); $shards = $this->getSelectedShards();
if (is_null($shards)) { if (empty($shards)) {
$shards = array_keys($allShards); $shards = array_keys($allShards);
} }
......
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