protected static function Spellcheck::getBackend in Search API Solr 8.2
Retrieves the backend for the given index, if it supports autocomplete.
Parameters
\Drupal\search_api\IndexInterface $index: The search index.
Return value
SolrAutocompleteInterface|null The backend plugin of the index's server, if it exists and supports autocomplete; NULL otherwise.
Throws
\Drupal\search_api\SearchApiException
2 calls to Spellcheck::getBackend()
- Spellcheck::getAutocompleteSuggestions in src/
Plugin/ search_api_autocomplete/ suggester/ Spellcheck.php - Retrieves autocompletion suggestions for some user input.
- Spellcheck::supportsSearch in src/
Plugin/ search_api_autocomplete/ suggester/ Spellcheck.php - Determines whether this plugin supports the given search.
File
- src/
Plugin/ search_api_autocomplete/ suggester/ Spellcheck.php, line 74
Class
- Spellcheck
- Provides a suggester plugin that retrieves suggestions from the server.
Namespace
Drupal\search_api_solr\Plugin\search_api_autocomplete\suggesterCode
protected static function getBackend(IndexInterface $index) {
if (!$index
->hasValidServer()) {
return NULL;
}
$server = $index
->getServerInstance();
$backend = $server
->getBackend();
if ($server
->supportsFeature('search_api_autocomplete') && $backend instanceof SolrAutocompleteInterface) {
return $backend;
}
return NULL;
}