You are here

function search_api_solr_search_api_items_indexed in Search API Solr 8.2

Implements function hook_search_api_items_indexed().

Parameters

\Drupal\search_api\Entity\Index $index:

string[] $processed_ids:

Throws

\Drupal\search_api\SearchApiException

File

./search_api_solr.module, line 485

Code

function search_api_solr_search_api_items_indexed($index, $processed_ids) {
  if ($index
    ->getServerInstance()
    ->getBackend() instanceof SolrBackendInterface) {

    // The _search_all() streaming expression needs a row limit that much higher
    // then the real number of rows. Therefore we set a 10 times higher row
    // limit as indexed documents. To increase the number of query result cache
    // hits we set "normalize" the nearest higher power of 2.
    $rows = $index
      ->getTrackerInstance()
      ->getIndexedItemsCount() * 10;
    for ($i = pow(2, 14); $i < $rows; $i *= 2) {
    }
    \Drupal::state()
      ->set('search_api_solr.' . $index
      ->id() . '.search_all_rows', $i);
  }
}