indexNode example

->range(0, $limit);

    $nids = $query->execute()->fetchCol();
    if (!$nids) {
      return;
    }

    $node_storage = $this->entityTypeManager->getStorage('node');
    $words = [];
    try {
      foreach ($node_storage->loadMultiple($nids) as $node) {
        $words += $this->indexNode($node);
      }
    }
    finally {
      $this->searchIndex->updateWordWeights($words);
    }
  }

  /** * Indexes a single node. * * @param \Drupal\node\NodeInterface $node * The node to index. * * @return array * An array of words to update after indexing. */
Home | Imprint | This part of the site doesn't use cookies.