Skip to content

Commit

Permalink
Make spellcheck configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Oct 22, 2019
1 parent aa6a833 commit 53fe09e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/CwpSearchEngine.php
Expand Up @@ -30,6 +30,12 @@ class CwpSearchEngine
private static $search_options = [
'hl' => 'true',
];

/**
* @var boolean
* @config
*/
private static $use_spellcheck = true;

/**
* Additional search options to send to search when spellcheck
Expand Down Expand Up @@ -132,7 +138,8 @@ public function search($keywords, $classes, $searchIndex, $limit = -1, $start =

try {
// Begin search
$result = $this->getResult($keywords, $classes, $searchIndex, $limit, $start, true);
$spellcheck = $this->config()->get('use_spellcheck');
$result = $this->getResult($keywords, $classes, $searchIndex, $limit, $start, $spellcheck);

// Return results if we don't need to refine this any further
if (!$followSuggestions || $result->hasResults() || !$result->getSuggestion()) {
Expand Down

0 comments on commit 53fe09e

Please sign in to comment.