diff --git a/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php b/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php index 474f6944a95fc8945dc069c1da2a2ddb7c68b038..5eea28ca728e0ebb5e2db9c167b8950f7e9929da 100644 --- a/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php +++ b/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php @@ -59,10 +59,8 @@ class ResultsFactory extends \VuFind\Search\Results\ResultsFactory ) { $solr = parent::__invoke($container, $requestedName, $options); $config = $container->get('VuFind\Config\PluginManager')->get('config'); - $spellConfig = isset($config->Spelling) - ? $config->Spelling : null; $solr->setSpellingProcessor( - new \VuFind\Search\Solr\SpellingProcessor($spellConfig) + new \VuFind\Search\Solr\SpellingProcessor($config->Spelling ?? null) ); return $solr; } diff --git a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php index c8dc0339af03a8a87397c384b9666c5ad3e6a3a3..03720d3fbc75c857d3efacee16fa1703ab5a9144 100644 --- a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php +++ b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php @@ -47,21 +47,21 @@ class SpellingProcessor * * @var int */ - protected $spellingLimit = 3; + protected $spellingLimit; /** * Spell check words with numbers in them? * * @var bool */ - protected $spellSkipNumeric = true; + protected $spellSkipNumeric; /** * Offer expansions on terms as well as basic replacements? * * @var bool */ - protected $expand = true; + protected $expand; /** * Show the full modified search phrase on screen rather then just the suggested @@ -69,7 +69,7 @@ class SpellingProcessor * * @var bool */ - protected $phrase = false; + protected $phrase; /** * Constructor @@ -78,18 +78,10 @@ class SpellingProcessor */ public function __construct($config = null) { - if (isset($config->limit)) { - $this->spellingLimit = $config->limit; - } - if (isset($config->skip_numeric)) { - $this->spellSkipNumeric = $config->skip_numeric; - } - if (isset($config->expand)) { - $this->expand = $config->expand; - } - if (isset($config->phrase)) { - $this->phrase = $config->phrase; - } + $this->spellingLimit = $config->limit ?? 3; + $this->spellSkipNumeric = $config->skip_numeric ?? true; + $this->expand = $config->expand ?? true; + $this->phrase = $config->phrase ?? false; } /**