You are here

public function SearchApiFederatedSolrCanonicalUrl::alterItems in Search API Federated Solr 7

Same name and namespace in other branches
  1. 7.3 src/SearchApiFederatedSolrCanonicalUrl.php \SearchApiFederatedSolrCanonicalUrl::alterItems()
  2. 7.2 src/SearchApiFederatedSolrCanonicalUrl.php \SearchApiFederatedSolrCanonicalUrl::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/SearchApiFederatedSolrCanonicalUrl.php, line 37

Class

SearchApiFederatedSolrCanonicalUrl
Class SearchApiFederatedSolrCanonicalUrl Provides a Search API index data alteration that indicates the preferred URL content is available on to each indexed item.

Code

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