function search_mark_for_reindex in Drupal 8
Changes the timestamp on indexed items to 'now' to force reindexing.
This function is meant for use by search page plugins, or for building a user interface that lets users mark all or parts of the search index for reindexing.
Parameters
string $type: (optional) The plugin ID or other machine-readable type of this item. If omitted, the entire search index is marked for reindexing, and $sid and $langcode are ignored.
int $sid: (optional) An ID number identifying this particular item (e.g., node ID). If omitted, everything matching $type is marked, and $langcode is ignored.
string $langcode: (optional) The language code to clear. If omitted, everything matching $type and $sid is marked.
Deprecated
in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\search\SearchIndex::markForReindex() instead.
See also
https://www.drupal.org/node/3075696
1 call to search_mark_for_reindex()
- SearchDeprecationTest::testMarkForReindex in core/
modules/ search/ tests/ src/ Kernel/ SearchDeprecationTest.php - @expectedDeprecation search_mark_for_reindex() is deprecated in drupal:8.8.0 and is removed in drupal:9.0.0. Use \Drupal\search\SearchIndex::markForReindex() instead. See https://www.drupal.org/node/3075696
File
- core/
modules/ search/ search.module, line 431 - Enables site-wide keyword searching.
Code
function search_mark_for_reindex($type = NULL, $sid = NULL, $langcode = NULL) {
@trigger_error("search_mark_for_reindex() is deprecated in drupal:8.8.0 and is removed in drupal:9.0.0. Use \\Drupal\\search\\SearchIndex::markForReindex() instead. See https://www.drupal.org/node/3075696", E_USER_DEPRECATED);
\Drupal::service('search.index')
->markForReindex($type, $sid, $langcode);
}