You are here

public function ElasticsearchConnectorSearchApiHighlight::supportsIndex in Elasticsearch Connector 7.5

Same name and namespace in other branches
  1. 7 modules/elasticsearch_connector_search_api/includes/processor_highlight.inc \ElasticsearchConnectorSearchApiHighlight::supportsIndex()
  2. 7.2 modules/elasticsearch_connector_search_api/includes/processor_highlight.inc \ElasticsearchConnectorSearchApiHighlight::supportsIndex()

Check whether this processor is applicable for a certain index.

This can be used for hiding the processor on the index's "Filters" tab. To avoid confusion, you should only use criteria that are immutable, such as the index's item type. Also, since this is only used for UI purposes, you should not completely rely on this to ensure certain index configurations and at least throw an exception with a descriptive error message if this is violated on runtime.

Parameters

SearchApiIndex $index: The index to check for.

Return value

boolean TRUE if the processor can run on the given index; FALSE otherwise.

Overrides SearchApiAbstractProcessor::supportsIndex

2 calls to ElasticsearchConnectorSearchApiHighlight::supportsIndex()
ElasticsearchConnectorSearchApiHighlight::postprocessSearchResults in modules/elasticsearch_connector_search_api/includes/processor_highlight.inc
Does nothing.
ElasticsearchConnectorSearchApiHighlight::preprocessSearchQuery in modules/elasticsearch_connector_search_api/includes/processor_highlight.inc
Calls processKeys() for the keys and processFilters() for the filters.

File

modules/elasticsearch_connector_search_api/includes/processor_highlight.inc, line 19
Contains the SearchApiHighlight class.

Class

ElasticsearchConnectorSearchApiHighlight
@file Contains the SearchApiHighlight class.

Code

public function supportsIndex(SearchApiIndex $index) {
  $server = $index
    ->server();
  if (!empty($server) && $server->class == 'search_api_elasticsearch_connector') {
    return TRUE;
  }
  else {
    return FALSE;
  }
}