You are here

public function SearchApiFederatedSolrSiteName::alterItems in Search API Federated Solr 7.2

Same name and namespace in other branches
  1. 7.3 src/SearchApiFederatedSolrSiteName.php \SearchApiFederatedSolrSiteName::alterItems()
  2. 7 src/SearchApiFederatedSolrSiteName.php \SearchApiFederatedSolrSiteName::alterItems()

Alter items before indexing.

Items which are removed from the array won't be indexed, but will be marked as clean for future indexing. This could for instance be used to implement some sort of access filter for security purposes (e.g., don't index unpublished nodes or comments).

Parameters

array $items: An array of items to be altered, keyed by item IDs.

Overrides SearchApiAlterCallbackInterface::alterItems

File

src/SearchApiFederatedSolrSiteName.php, line 37

Class

SearchApiFederatedSolrSiteName
Class SearchApiFederatedSolrSiteName Provides a Search API index data alteration that adds a "Site Name" property to each indexed item.

Code

public function alterItems(array &$items) {
  if ($this
    ->useDomainAccess()) {
    $this
      ->addDomainName($items);
  }
  else {
    $this
      ->addSiteName($items);
  }
}