function SearchIndexInterface::index

Same name in other branches
  1. 9 core/modules/search/src/SearchIndexInterface.php \Drupal\search\SearchIndexInterface::index()
  2. 8.9.x core/modules/search/src/SearchIndexInterface.php \Drupal\search\SearchIndexInterface::index()
  3. 10 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.

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);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.