You are here

public function SearchIndexInterface::index in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/search/src/SearchIndexInterface.php \Drupal\search\SearchIndexInterface::index()

Updates the full-text search index for a particular item.

Parameters

string $type: The plugin ID or other machine-readable type of this item, which should be less than 64 bytes.

int $sid: An ID number identifying this particular item (e.g., node ID).

string $langcode: Language code for the language of the text being indexed.

string $text: The content of this item. Must be a piece of HTML or plain text.

bool $update_weights: (optional) TRUE if word weights should be updated. FALSE otherwise; defaults to TRUE. If you pass in FALSE, then you need to have your calls to this method in a try/finally block, and at the end of your index run in the finally clause, you will need to call self::updateWordWeights(), passing in all of the returned words, to update the word weights.

Return value

string[] The words to be updated.

Throws

\Drupal\search\Exception\SearchIndexException If there is an error indexing the text.

1 method overrides SearchIndexInterface::index()
SearchIndex::index in core/modules/search/src/SearchIndex.php
Updates the full-text search index for a particular item.

File

core/modules/search/src/SearchIndexInterface.php, line 38

Class

SearchIndexInterface
Provides search index management functions.

Namespace

Drupal\search

Code

public function index($type, $sid, $langcode, $text, $update_weights = TRUE);