6

I' switching core search to SOLR. The core search module still needs to be enabled for SOLR to work. How to I remove the (rather large) core search index?

The "search settings / clear index" option says that it won't clear the index and just update new items instead.

I came across search_reindex(). Do I just run that function?

8

If I'm reading the function correctly, search_reindex won't actually empty the search index - it just tells all modules that use search to start re-indexing content.

Uninstalling and re-installing the search module using the "unistall" tab at admin/modules will empty all of the search tables. You will have to temporarily disable all dependent modules to do this.

Alternately, you can empty these tables using the TRUNCATE mysql command. The tables needing to be emptied are search_dataset, search_index, search_total and search_node_links. You could also empty the tables using a database management tool - just be sure to leave the table structure intact - you want to empty the tables, not delete them.

You will then need to disable core search indexing to prevent the search index from filling back up. In your sites/default/settings.php file, you can add:

$conf['search_cron_limit'] = '0';

to prevent Drupal from adding items back into the index on cron runs (while still leaving the search module intact.)

1
  • thanks! I can disable search_cron in the Elysia cron settings. – uwe Sep 25 '12 at 0:57
0

You may also use the Search index wipe contributed module which truncates the search related tables.

This module clean up search index built by search module. It is helpful while deploying large sites whose search index becomes massive. The reindex button does not clear the search index but rather gradually replaces existing search data with new data as items are reindexed. This module was originated by https://drupal.org/comment/4026188#comment-4026188

1
  • Hi Sagar and welcome. Please provide some sort of description when linking to modules, so it is easier to see what the module does :) – Neograph734 Mar 16 '16 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.