Skip to content
Snippets Groups Projects
Commit 1ad89397 authored by Demian Katz's avatar Demian Katz
Browse files

Code simplification.

parent df8c4fe3
Branches
Tags
No related merge requests found
...@@ -59,10 +59,8 @@ class ResultsFactory extends \VuFind\Search\Results\ResultsFactory ...@@ -59,10 +59,8 @@ class ResultsFactory extends \VuFind\Search\Results\ResultsFactory
) { ) {
$solr = parent::__invoke($container, $requestedName, $options); $solr = parent::__invoke($container, $requestedName, $options);
$config = $container->get('VuFind\Config\PluginManager')->get('config'); $config = $container->get('VuFind\Config\PluginManager')->get('config');
$spellConfig = isset($config->Spelling)
? $config->Spelling : null;
$solr->setSpellingProcessor( $solr->setSpellingProcessor(
new \VuFind\Search\Solr\SpellingProcessor($spellConfig) new \VuFind\Search\Solr\SpellingProcessor($config->Spelling ?? null)
); );
return $solr; return $solr;
} }
......
...@@ -47,21 +47,21 @@ class SpellingProcessor ...@@ -47,21 +47,21 @@ class SpellingProcessor
* *
* @var int * @var int
*/ */
protected $spellingLimit = 3; protected $spellingLimit;
/** /**
* Spell check words with numbers in them? * Spell check words with numbers in them?
* *
* @var bool * @var bool
*/ */
protected $spellSkipNumeric = true; protected $spellSkipNumeric;
/** /**
* Offer expansions on terms as well as basic replacements? * Offer expansions on terms as well as basic replacements?
* *
* @var bool * @var bool
*/ */
protected $expand = true; protected $expand;
/** /**
* Show the full modified search phrase on screen rather then just the suggested * Show the full modified search phrase on screen rather then just the suggested
...@@ -69,7 +69,7 @@ class SpellingProcessor ...@@ -69,7 +69,7 @@ class SpellingProcessor
* *
* @var bool * @var bool
*/ */
protected $phrase = false; protected $phrase;
/** /**
* Constructor * Constructor
...@@ -78,18 +78,10 @@ class SpellingProcessor ...@@ -78,18 +78,10 @@ class SpellingProcessor
*/ */
public function __construct($config = null) public function __construct($config = null)
{ {
if (isset($config->limit)) { $this->spellingLimit = $config->limit ?? 3;
$this->spellingLimit = $config->limit; $this->spellSkipNumeric = $config->skip_numeric ?? true;
} $this->expand = $config->expand ?? true;
if (isset($config->skip_numeric)) { $this->phrase = $config->phrase ?? false;
$this->spellSkipNumeric = $config->skip_numeric;
}
if (isset($config->expand)) {
$this->expand = $config->expand;
}
if (isset($config->phrase)) {
$this->phrase = $config->phrase;
}
} }
/** /**
......
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