You are here

function search_index in Drupal 8

Same name and namespace in other branches
  1. 4 modules/search.module \search_index()
  2. 5 modules/search/search.module \search_index()
  3. 6 modules/search/search.module \search_index()
  4. 7 modules/search/search.module \search_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.

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\search\SearchIndex::index() instead.

See also

https://www.drupal.org/node/3075696

Related topics

1 call to search_index()
SearchDeprecationTest::testIndex in core/modules/search/tests/src/Kernel/SearchDeprecationTest.php
@expectedDeprecation search_index() is deprecated in drupal:8.8.0 and is removed in drupal:9.0.0. Use \Drupal\search\SearchIndex::index() instead. See https://www.drupal.org/node/3075696
15 string references to 'search_index'
CommentDefaultFormatter::viewElements in core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
Builds a renderable array for a field value.
CommentLinkBuilder::buildCommentedEntityLinks in core/modules/comment/src/CommentLinkBuilder.php
Builds links for the given entity.
CommentLinkBuilderTest::getLinkCombinations in core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
Data provider for ::testCommentLinkBuilder.
d6_view_modes.yml in core/modules/node/migrations/d6_view_modes.yml
core/modules/node/migrations/d6_view_modes.yml
drupal7.php in core/modules/migrate_drupal/tests/fixtures/drupal7.php
A database agnostic dump for testing purposes.

... See full list

File

core/modules/search/search.module, line 403
Enables site-wide keyword searching.

Code

function search_index($type, $sid, $langcode, $text) {
  @trigger_error("search_index() is deprecated in drupal:8.8.0 and is removed in drupal:9.0.0. Use \\Drupal\\search\\SearchIndex::index() instead. See https://www.drupal.org/node/3075696", E_USER_DEPRECATED);
  \Drupal::service('search.index')
    ->index($type, $sid, $langcode, $text);
}