Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SearchIndexInterface.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal