I have a custom content type that I simply want to not be indexed by the Drupal search engine. Yes, I can hide it from the search results, but there are hundreds of thousands of these nodes and rebuilding the index takes days. After much searching and trial/error, I came across this solution from ChrisPliakus.
You can see my query below in the update_index hook, where I exclude MY_CONTENT_TYPE from the query. I've tested the query manually and it seems to show nodes other than the one I want to ignore, which I think is the goal there.
However, when I run drush cron --verbose, I still see those nodes getting indexed :(
/**
* Implements hook_module_implements_alter().
*/
function MYMODULE_module_implements_alter(&$implementations, $hook) {
if ('update_index' == $hook) {
unset($implementations['node']);
}
}
/**
* Implements hook_update_index().
*
* @see node_update_index().
*/
function MYMODULE_update_index() {
$limit = (int) variable_get('search_cron_limit', 100);
$result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE (d.sid IS NULL OR d.reindex <> 0) AND n.type != 'MY_CONTENT_TYPE' ORDER BY d.reindex ASC, n.nid ASC", 0, $limit, array(), array('target' => 'slave'));
foreach ($result as $node) {
_node_index_node($node);
}
}
Any ideas? Thanks in advance!