class SearchApiSpellcheckElasticsearch in Elasticsearch Connector 7.2
Same name and namespace in other branches
- 7.5 modules/elasticsearch_connector_search_api/includes/spellcheck.inc \SearchApiSpellcheckElasticsearch
- 7 modules/elasticsearch_connector_search_api/includes/spellcheck.inc \SearchApiSpellcheckElasticsearch
Spellcheck class which can provide spelling suggestions. The constructor populates the instance with any suggestions returned by Solr.
Hierarchy
- class \SearchApiSpellcheck implements SearchApiSpellcheckInterface
Expanded class hierarchy of SearchApiSpellcheckElasticsearch
File
- modules/
elasticsearch_connector_search_api/ includes/ spellcheck.inc, line 11 - Contains the SearchApiSpellcheckSolr class.
View source
class SearchApiSpellcheckElasticsearch extends SearchApiSpellcheck {
/**
* Constructs a SearchApiSpellcheckSolr object.
*
* If Solr has returned spelling suggestion then loop through them and add
* them to this spellcheck service.
*
* @param object $response
* The Solr response object.
*/
function __construct($response) {
if (isset($response['suggest'])) {
$suggestions = $response['suggest'];
foreach ($suggestions as $suggestion_name => $data) {
foreach ($data as $suggestion) {
foreach ($suggestion['options'] as $option) {
$this
->addSuggestion(new SearchApiSpellcheckSuggestion($suggestion['text'], $option['text']));
}
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SearchApiSpellcheck:: |
protected | property | ||
SearchApiSpellcheck:: |
protected | property | ||
SearchApiSpellcheck:: |
public | function | This call also maintains a list of sub interances using the same interface. These services are then also check when getSuggestion() is called. | |
SearchApiSpellcheck:: |
public | function | Add a suggestion object to the class which is stored and then checked when getSuggestion() is called. | |
SearchApiSpellcheck:: |
public | function | Pass a string and if it can be improved by any of the suggestions or sub-services added then return a suggesiton. If no change can be suggested return FALSE. | |
SearchApiSpellcheck:: |
public | function | Accepts a Drupal arg number which is used to get the value submitted and returns a link to the current page with whatever value is in the URL argument replaced with a suggestion. | |
SearchApiSpellcheck:: |
public | function | Accepts a a query string key which is used to get the value submitted and | |
SearchApiSpellcheck:: |
public | function |
Check if any of the added spellcheck suggestions match either all or part
of the string. Overrides SearchApiSpellcheckInterface:: |
|
SearchApiSpellcheckElasticsearch:: |
function | Constructs a SearchApiSpellcheckSolr object. |