function hook_search_api_index_items_alter in Search API 7
Same name and namespace in other branches
- 8 search_api.api.php \hook_search_api_index_items_alter()
Allows you to log or alter the items that are indexed.
Please be aware that generally preventing the indexing of certain items is deprecated. This is better done with data alterations, which can easily be configured and only added to indexes where this behaviour is wanted. If your module will use this hook to reject certain items from indexing, please document this clearly to avoid confusion.
Parameters
array $items: The entities that will be indexed (before calling any data alterations).
SearchApiIndex $index: The search index on which items will be indexed.
1 invocation of hook_search_api_index_items_alter()
- SearchApiIndex::index in includes/
index_entity.inc - Indexes items on this index.
File
- ./
search_api.api.php, line 310 - Hooks provided by the Search API module.
Code
function hook_search_api_index_items_alter(array &$items, SearchApiIndex $index) {
foreach ($items as $id => $item) {
if ($id % 5 == 0) {
unset($items[$id]);
}
}
example_store_indexed_entity_ids($index->item_type, array_keys($items));
}