summaryrefslogtreecommitdiff
path: root/modules/node.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-11-04 06:47:03 +0000
committerDries Buytaert <dries@buytaert.net>2004-11-04 06:47:03 +0000
commitb6eee48c887e66b195a2b88fe905872af83bbade (patch)
tree7f3f4f6b67637670eb654578b66bed204e9c4dab /modules/node.module
parentd13943e245403e046168c921a57c13f08bfc6ca9 (diff)
downloadbrdo-b6eee48c887e66b195a2b88fe905872af83bbade.tar.gz
brdo-b6eee48c887e66b195a2b88fe905872af83bbade.tar.bz2
- Patch #12232 by Steven: more search improvements:
+ When a comment is posted, a node needs to be re-indexed. Luckily, we can use node_comment_statistics for this easily. + When a node is deleted, it should be deleted from the search index as well. + The search wipe didn't properly remove links to nodes from the index. + Section url was faulty in _help. + Minor code rearrangement.
Diffstat (limited to 'modules/node.module')
-rw-r--r--modules/node.module5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/node.module b/modules/node.module
index 501272ae2..1f2b24f0d 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1409,6 +1409,9 @@ function node_delete($edit) {
// Clear the cache so an anonymous poster can see the node being deleted.
cache_clear_all();
+ // Remove this node from the search index
+ search_wipe($node->nid, 'node');
+
watchdog('special', t('%type: deleted %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")));
$output = t('The node has been deleted.');
}
@@ -1515,7 +1518,7 @@ function node_update_index() {
$last = variable_get('node_cron_last', 0);
$limit = (int)variable_get('search_cron_limit', 100);
- $result = db_query_range('SELECT nid FROM {node} n WHERE n.status = 1 AND moderate = 0 AND (created > %d OR changed > %d) ORDER BY GREATEST(created, changed) ASC', $last, $last, 0, $limit);
+ $result = db_query_range('SELECT n.nid FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = 1 AND n.moderate = 0 AND (n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d) ORDER BY GREATEST(n.created, n.changed, c.last_comment_timestamp) ASC', $last, $last, $last, 0, $limit);
while ($node = db_fetch_object($result)) {
$node = node_load(array('nid' => $node->nid));