I'd like to suggest that you consider allowing users to disable searching for each content type available. For example, I run the quotes module, and have over 47,000 qutoes to randomly display. I dont particularly want them indexed simply due to the time and load involved.

This may sound specific to a single users issue however with the upcoming content creation set and flexinode types likely to become popular, others may want to not index certain content types on their sites.

Comments

killes@www.drop.org’s picture

Version: 4.7.0 » x.y.z

Sounds usefull, but new features go into 4.8.

rimshot’s picture

I vote for this change to the search module. I'm running into this exact same problem right now. Any ideas on how I could not have the cron.php index any of my quotes? Just curious. Keep up the great owrk drupal team. Drupal continues to amaze me with its functionality.

davidtrainer’s picture

Version: x.y.z » 5.x-dev

update and subscribe. I need this too

Thomas Sewell’s picture

This could be done by creating an admin menu similar to that used in the search_config module and using search_wipe as in http://drupal.org/node/84955, although that's probably not the most efficient way. A better way might be to modify the db sql used so that it doesn't select content types with a search permission that isn't set.

Hmmm..... I'm going to need to work up a hack to keep sensitive personal information out of search results on one of my sites. If the results are at all compatible with the general user population, I'll post the code back here.

Thomas Sewell’s picture

According to the comments, the node.module purposefully doesn't use db_rewrite_sql in order to index everything. That leaves out rewriting the sql in another module unless the core node.module was modified as well.

Another alternative would be to add a hook_update_index function to the cck module, since most custom content types that need to be hidden would likely be cck types anyway.

The only other obvious alternative is to use a theme function to override things.

Thomas Sewell’s picture

For my personal solution, I created a custom module called notsearch that contains the following:

/**
 * Implementation of hook_update_index(). Make sure sensitive records aren't indexed.
 */
function notsearch_update_index() {
 if (function_exists('search_wipe')) {
    $result = db_query("SELECT nid FROM {node} WHERE type = 'content_employment_application' OR type = 'content_enrollment_application'");      
    while ($data = db_fetch_object($result)) {
      search_wipe($data->nid, 'node');
    }
  }
}

Once activated, run cron.php and those content types will be gone from the search index.

So if you are desperate, create a mini-module and change the type= arguments in the query above to match what you want to exclude ('select distinct Type from node;' is useful to get the exact content name you may need). For the long term, it would be better to have the WHERE clause fed from a variable that is set by a proper admin config form, but this is all I have time for tonight.

When I have more time I may turn it into a proper configurable module.

yched’s picture

Status: Active » Closed (duplicate)

Please review D6 patch in http://drupal.org/node/111744