search_mark_for_reindex($type = NULL, $sid = NULL, $langcode = NULL)
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.
File
- core/modules/search/search.module, line 572
- Enables site-wide keyword searching.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | function search_mark_for_reindex( $type = NULL, $sid = NULL, $langcode = NULL) { $query = db_update( 'search_dataset' ) ->fields( array ( 'reindex' => REQUEST_TIME)) // Only mark items that were not previously marked for reindex, so that // marked items maintain their priority by 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(); } |
Please login to continue.