diff --git a/module/VuFind/src/VuFind/Search/Solr/MultiIndexListener.php b/module/VuFind/src/VuFind/Search/Solr/MultiIndexListener.php index 36502f9cf8590a8b89e2a5eda93adab3daaba3d3..dfbacd5d5fafaba2982f40e94591019d701e13af 100644 --- a/module/VuFind/src/VuFind/Search/Solr/MultiIndexListener.php +++ b/module/VuFind/src/VuFind/Search/Solr/MultiIndexListener.php @@ -124,7 +124,14 @@ class MultiIndexListener } else { // In any other context, we should make sure our field values are // 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); $specs = $this->getSearchSpecs($fields); $backend->getQueryBuilder()->setSpecs($specs); diff --git a/module/VuFind/src/VuFind/Search/Solr/Params.php b/module/VuFind/src/VuFind/Search/Solr/Params.php index 3172d8cd4eaef3a2e44eaa7c0b578310c4e4beea..f63adb426cca9fa10a623b39bbe9f773ba705fed 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Params.php +++ b/module/VuFind/src/VuFind/Search/Solr/Params.php @@ -459,7 +459,7 @@ class Params extends \VuFind\Search\Base\Params // Shards $allShards = $this->getOptions()->getShards(); $shards = $this->getSelectedShards(); - if (is_null($shards)) { + if (empty($shards)) { $shards = array_keys($allShards); }