You are here

public function ElasticsearchConnectorSearchApiPrefixSearch::supportsIndex in Elasticsearch Connector 7.2

Same name and namespace in other branches
  1. 7.5 modules/elasticsearch_connector_search_api/includes/processor_prefix_search.inc \ElasticsearchConnectorSearchApiPrefixSearch::supportsIndex()
  2. 7 modules/elasticsearch_connector_search_api/includes/processor_prefix_search.inc \ElasticsearchConnectorSearchApiPrefixSearch::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

File

modules/elasticsearch_connector_search_api/includes/processor_prefix_search.inc, line 19
Contains the ElasticsearchConnectorSearchApiPrefixSearch class.

Class

ElasticsearchConnectorSearchApiPrefixSearch
@file Contains the ElasticsearchConnectorSearchApiPrefixSearch class.

Code

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