You are here

public function SearchSubscriber::getSearchV3IndexKeys in Acquia Search 2.x

Fetches the search v3 index keys.

Return value

array|null Search v3 index keys, NULL if unavailable.

1 call to SearchSubscriber::getSearchV3IndexKeys()
SearchSubscriber::getDerivedKey in src/EventSubscriber/SearchSubscriber.php
Get the derived key.

File

src/EventSubscriber/SearchSubscriber.php, line 323

Class

SearchSubscriber
Extends Solarium plugin: authenticate, etc.

Namespace

Drupal\acquia_search\EventSubscriber

Code

public function getSearchV3IndexKeys() {
  $core_service = acquia_search_get_core_service();
  if (!$core_service
    ->isPreferredCoreAvailable()) {
    return;
  }
  $core = $core_service
    ->getPreferredCore();

  // Check the core version to see if it's v2 or v3 core.
  if (empty($core['version']) || $core['version'] !== 'v3') {
    return;
  }
  $search_v3_client = acquia_search_get_v3_client();
  if (!$search_v3_client) {
    return;
  }
  $storage = new Storage();
  $acquia_identifier = $storage
    ->getIdentifier();
  $search_v3_index = $search_v3_client
    ->getKeys($core['core_id'], $acquia_identifier);
  if (is_array($search_v3_index) && !empty($search_v3_index)) {
    return $search_v3_index;
  }
}