protected function SearchApiSolrBackend::getAutocompleteQuery in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::getAutocompleteQuery()
- 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::getAutocompleteQuery()
Returns a Solarium autocomplete query.
Parameters
string $incomplete_key: The start of another fulltext keyword for the search, which should be completed.
string $user_input: The complete user input for the fulltext search keywords so far.
Return value
\Drupal\search_api_solr\Solarium\Autocomplete\Query|null The Solarium autocomplete query or NULL if the Solr version is not compatible.
Throws
\Drupal\Component\Plugin\Exception\PluginException
\Drupal\search_api\SearchApiException
3 calls to SearchApiSolrBackend::getAutocompleteQuery()
- SearchApiSolrBackend::getAutocompleteSuggestions in src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php - Implements autocomplete compatible to AutocompleteBackendInterface.
- SearchApiSolrBackend::getSpellcheckSuggestions in src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php - SearchApiSolrBackend::getSuggesterSuggestions in src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php
File
- src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php, line 3542
Class
- SearchApiSolrBackend
- Apache Solr backend for search api.
Namespace
Drupal\search_api_solr\Plugin\search_api\backendCode
protected function getAutocompleteQuery(&$incomplete_key, &$user_input) {
// Make the input lowercase as the indexed data is (usually) also all
// lowercase.
$incomplete_key = mb_strtolower($incomplete_key);
$user_input = mb_strtolower($user_input);
$connector = $this
->getSolrConnector();
$solr_version = $connector
->getSolrVersion();
if (version_compare($solr_version, '6.5', '=')) {
$this
->getLogger()
->error('Solr 6.5.x contains a bug that breaks the autocomplete feature. Downgrade to 6.4.x or upgrade to 6.6.x at least.');
return NULL;
}
return $connector
->getAutocompleteQuery();
}