diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2006-01-18 21:31:40 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2006-01-18 21:31:40 +0000 |
commit | ecd26ac8ae495d785a78f34e3e4170904be7f023 (patch) | |
tree | 74ab6705ec1035e735b0369423351d36c4dd6aba /modules/search | |
parent | 9528c30037fce0ab07eac7b054d1b89d16b412b1 (diff) | |
download | brdo-ecd26ac8ae495d785a78f34e3e4170904be7f023.tar.gz brdo-ecd26ac8ae495d785a78f34e3e4170904be7f023.tar.bz2 |
- #42277: Make node search indexing more robust against bad nodes and timeouts.
Diffstat (limited to 'modules/search')
-rw-r--r-- | modules/search/search.module | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/search/search.module b/modules/search/search.module index e8294107d..42c658123 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -292,10 +292,21 @@ function search_dirty($word = null) { * search_dirty). */ function search_cron() { + // We register a shutdown function to ensure that search_total is always up + // to date. + register_shutdown_function('search_update_totals'); + // Update word index foreach (module_list() as $module) { module_invoke($module, 'update_index'); } +} + +/** + * This function is called on shutdown to ensure that search_total is always + * up to date (even if cron times out or otherwise fails). + */ +function search_update_totals() { // Update word IDF (Inverse Document Frequency) counts for new/changed words foreach (search_dirty() as $word => $dummy) { // Get total count |