function sbp_attach_nodeapi in Search by Page 6
Implementation of hook_nodeapi().
When a node is updated, sets any attached files for reindexing at the next cron run. When a node is deleted, remove its attached files from the search index.
File
- ./
sbp_attach.module, line 611 - Module file for Search by Page Attachments, a sub-module for Search by Page.
Code
function sbp_attach_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
if ($op == 'update' || $op == 'delete') {
// Find the file IDs in our database associated with this node ID.
$res = db_query('SELECT fid FROM {sbpa_files} WHERE nid = %d', $node->nid);
while ($item = db_fetch_object($res)) {
if ($op == 'update') {
search_by_page_force_reindex('sbp_attach', $item->fid);
}
else {
search_by_page_force_remove('sbp_attach', $item->fid);
}
}
}
}