function search_mark_for_reindex in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/search/search.module \search_mark_for_reindex()
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.
5 calls to search_mark_for_reindex()
- NodeSearch::markForReindex in core/
modules/ node/ src/ Plugin/ Search/ NodeSearch.php - Marks the search index for reindexing for this plugin.
- node_reindex_node_search in core/
modules/ node/ node.module - Marks a node to be re-indexed by the node_search plugin.
- SearchCommentTest::assertCommentAccess in core/
modules/ search/ src/ Tests/ SearchCommentTest.php - Update search index and search for comment.
- SearchMultilingualEntityTest::testMultilingualSearch in core/
modules/ search/ src/ Tests/ SearchMultilingualEntityTest.php - Tests the indexing throttle and search results with multilingual nodes.
- SearchPageListBuilder::submitForm in core/
modules/ search/ src/ SearchPageListBuilder.php - Form submission handler.
File
- core/
modules/ search/ search.module, line 572 - Enables site-wide keyword searching.
Code
function search_mark_for_reindex($type = NULL, $sid = NULL, $langcode = NULL) {
$query = db_update('search_dataset')
->fields(array(
'reindex' => REQUEST_TIME,
))
->condition('reindex', 0);
if ($type) {
$query
->condition('type', $type);
if ($sid) {
$query
->condition('sid', $sid);
if ($langcode) {
$query
->condition('langcode', $langcode);
}
}
}
$query
->execute();
}