? block.module.diff ? themes/chameleon/images cvs diff: Diffing . cvs diff: Diffing database Index: database/database.mysql =================================================================== RCS file: /cvs/drupal/drupal/database/database.mysql,v retrieving revision 1.155 diff -u -r1.155 database.mysql --- database/database.mysql 31 Oct 2004 07:34:46 -0000 1.155 +++ database/database.mysql 3 Nov 2004 16:09:48 -0000 @@ -551,7 +551,7 @@ CREATE TABLE search_total ( word varchar(50) NOT NULL default '', count int(10) unsigned default NULL, - KEY word (word) + PRIMARY KEY word (word) ) TYPE=MyISAM; -- Index: database/updates.inc =================================================================== RCS file: /cvs/drupal/drupal/database/updates.inc,v retrieving revision 1.69 diff -u -r1.69 updates.inc --- database/updates.inc 31 Oct 2004 07:34:46 -0000 1.69 +++ database/updates.inc 3 Nov 2004 16:09:58 -0000 @@ -1946,7 +1946,7 @@ $ret[] = update_sql("CREATE TABLE {search_total} ( word varchar(50) NOT NULL default '', count int(10) unsigned default NULL, - KEY word (word) + PRIMARY KEY word (word) ) TYPE=MyISAM"); $ret[] = update_sql("DELETE FROM {variable} WHERE name = 'node_cron_last'"); cvs diff: Diffing includes cvs diff: Diffing misc cvs diff: Diffing modules Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.414 diff -u -r1.414 node.module --- modules/node.module 31 Oct 2004 07:34:47 -0000 1.414 +++ modules/node.module 3 Nov 2004 16:10:02 -0000 @@ -558,6 +558,9 @@ switch ($op) { case 'name': return t('content'); + case 'reset': + variable_del('node_cron_last'); + return; case 'search': $find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid '. node_access_join_sql() .' INNER JOIN {users} u ON n.uid = u.uid', 'n.status = 1 AND '. node_access_where_sql()); $results = array(); @@ -1524,7 +1527,7 @@ variable_set('node_cron_last', max($node->changed, $node->created)); if (node_hook($node, 'view')) { - node_invoke($node, 'view', false, true); + node_invoke($node, 'view', false, false); } else { $node = node_prepare($node, false); Index: modules/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search.module,v retrieving revision 1.89 diff -u -r1.89 search.module --- modules/search.module 31 Oct 2004 03:03:26 -0000 1.89 +++ modules/search.module 3 Nov 2004 16:10:05 -0000 @@ -48,7 +48,7 @@ case 'admin/modules#description': return t('Enables site-wide keyword searching.'); case 'admin/search': - return t('The search engine works by maintaining an index of words in your content. You can adjust the settings below to tweak the indexing behaviour. Note that indexing requires cron to be set up correctly.'); + return t('
The search engine works by maintaining an index of words in your site\'s content. You can adjust the settings below to tweak the indexing behaviour. Note that indexing requires cron to be set up correctly.
Changes to these settings will only apply to content that is indexed after the change. If you want them to apply to everything, you need to wipe the index with the button below.
'); case 'search#noresults': return t(''. t('Approximately %percentage of the site has been indexed.', array('%percentage' => $percentage)); + $status = '
'. t('Approximately %percentage of the site has been indexed.', array('%percentage' => $percentage)) .'
'; + $status .= ''. form_button(t('Wipe index')) . '
'; $output .= form_group('Indexing status', $status); print theme('page', system_settings_form($output)); } /** + * Wipe the search index. + */ +function search_wipe() { + db_query('DELETE FROM {search_index}'); + db_query('DELETE FROM {search_total}'); + module_invoke_all('search', 'reset'); + + drupal_set_message(t('The search index has been wiped.')); + drupal_goto('admin/settings/search'); +} + +/** * Marks a word as dirty (or retrieves the list of dirty words). This is used * during indexing (cron). Words which are dirty have outdated total counts in * the search_total table, and need to be recounted. @@ -150,15 +166,24 @@ * search_dirty). */ function search_cron() { - /* Update word index */ + // Update word index foreach (module_list() as $module) { module_invoke($module, 'update_index'); } - /* Update word counts for new/changed words */ + // Update word counts for new/changed words foreach (search_dirty() as $word => $dummy) { - db_query("DELETE FROM {search_total} WHERE word = '%s'", $word); $total = db_result(db_query("SELECT SUM(score) FROM {search_index} WHERE word = '%s'", $word)); - db_query("INSERT INTO {search_total} (word, count) VALUES ('%s', %d)", $word, $total); + db_query("UPDATE {search_total} SET count = %d WHERE word = '%s'", $total, $word); + if (!db_affected_rows()) { + db_query("INSERT INTO {search_total} (word, count) VALUES ('%s', %d)", $word, $total); + } + } + // Find words that were deleted from search_index, but are still in + // search_total. We use a LEFT JOIN between the two tables and keep only the + // rows which fail to join. + $result = db_query("SELECT t.word AS realword, i.word FROM {search_total} t LEFT JOIN {search_index} i ON t.word = i.word WHERE i.word IS NULL"); + while ($word = db_fetch_object($result)) { + db_query("DELETE FROM {search_total} WHERE word = '%s'", $word->realword); } } @@ -445,7 +470,10 @@ // Only perform search if there is non-whitespace search term: if (trim($keys)) { // Log the search keys: - watchdog('search', t('Search: %keys (%type).', array('%keys' => "$keys", '%type' => $type)), l(t('results'), 'search', NULL, 'keys='. urlencode($keys) . '&type='. urlencode($type))); + watchdog('search', + t('Search: %keys (%type).', array('%keys' => "$keys", '%type' => module_invoke($type, 'search', 'name'))), + l(t('results'), 'search', NULL, 'keys='. urlencode($keys) . '&type='. urlencode($type)) + ); // Collect the search results: $results = search_data($keys, $type); cvs diff: Diffing scripts cvs diff: Diffing themes cvs diff: Diffing themes/bluemarine cvs diff: Diffing themes/chameleon cvs diff: Diffing themes/chameleon/marvin cvs diff: Diffing themes/engines cvs diff: Diffing themes/engines/xtemplate cvs diff: Diffing themes/pushbutton