diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-11-18 21:28:34 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-11-18 21:28:34 +0000 |
commit | dc32e54f31e2b1308d5a6813dd644477076ec48d (patch) | |
tree | 2fad26cc5a6c212c6355afd79d88e5d9dfb29aa1 /modules/search.module | |
parent | 90e67a3acb226d7d0f45ecd117c1fcfcbe4f0b24 (diff) | |
download | brdo-dc32e54f31e2b1308d5a6813dd644477076ec48d.tar.gz brdo-dc32e54f31e2b1308d5a6813dd644477076ec48d.tar.bz2 |
Search.module:
- Caching index statistics
- Minor code cleanup
Diffstat (limited to 'modules/search.module')
-rw-r--r-- | modules/search.module | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/search.module b/modules/search.module index 27ecb0ba9..25f767bda 100644 --- a/modules/search.module +++ b/modules/search.module @@ -127,7 +127,7 @@ function search_admin() { $output = form_group(t('Indexing settings'), $group); // Collect some stats - $estimate = db_result(db_query('SELECT COUNT(DISTINCT sid) FROM {search_index}')); + $estimate = variable_get('search_indexed', 0); $nodes = max(1, db_result(db_query('SELECT COUNT(*) FROM {node}'))); $percentage = ((int)min(100, 100 * $estimate / $nodes)) . '%'; $status = '<p>'. t('Approximately %percentage of the site has been indexed.', array('%percentage' => $percentage)) .'</p>'; @@ -200,6 +200,10 @@ function search_cron() { while ($word = db_fetch_object($result)) { db_query("DELETE FROM {search_total} WHERE word = '%s'", $word->realword); } + + // Count indexed items (for administration screen) + $indexed = db_result(db_query('SELECT COUNT(DISTINCT sid) FROM {search_index}')); + variable_set('search_indexed', $indexed); } /** |