public function alterIndexedItems()

in modules/quanthub_indicator/src/Plugin/search_api/processor/QuanthubIndicatorProcessor.php [396:421]


  public function alterIndexedItems(array &$items) {
    parent::alterIndexedItems($items);
    $this->loadIndicators($items);

    foreach ($items as $key => $item) {
      $entity = $item->getOriginalObject()->getValue();

      if ($entity->getType() == 'indicator') {
        $dataset_urn = $entity
          ->field_dataset
          ->first()
          ->get('entity')
          ->getTarget()
          ->getValue()
          ->field_quanthub_urn
          ->getString();

        if (
          empty($this->loadedIndicators) ||
          empty($this->loadedIndicators[$dataset_urn][$item->getExtraData('indicator_id')])
        ) {
          unset($items[$key]);
        }
      }
    }
  }