If I delete a content type, but don't delete nodes of that type, they remain in the node table. As such, they will get indexed by SOLR search. Because they're not current active types (in node_type) table, there is no way to exclude them with the apachesolr_search_excluded_types.
Patch below adds additional logic to the apachesolr_search_apachesolr_types_exclude function to not index any invalid content types.
This could easily be moved to a separate module, but it seems central enough to make sense to be incorporated directly in this module.
Patch will be committed in next comment.
Comments
Comment #1
craigmc commentedPatch attached. Done at the root of apachesolr/ module folder.
PAtch rolled against dev HEAD
Comment #2
jpmckinney commentedIs there no hook in D6 that runs when operations are performed on a node type? It would be better to remove the nodes from the table at that time.
Comment #3
jpmckinney commentedIndeed, there is a hook_node_type (hook_node_type_delete in D7), which is currently implemented in 6.x (apachesolr_node_type). However, it doesn't handle the delete operation. Maybe we should just call apachesolr_rebuild_index_table() on the new/old type?
Comment #4
jpmckinney commentedAll branches affected.
Comment #5
pwolanin commentedprobably still an issue
Comment #6
nick_vhI've done the diff again and marking as reviewed for Drupal 7. The Drupal 6 patch from #4 is still valid and looks good to go also
Comment #7
nick_vhComment #8
nick_vhMy bad, left a dsm in there
Comment #9
nick_vhCommitted to both versions