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

craigmc’s picture

Version: 6.x-2.0-beta3 » 6.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new380 bytes

Patch attached. Done at the root of apachesolr/ module folder.

PAtch rolled against dev HEAD

jpmckinney’s picture

Status: Needs review » Needs work

Is 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.

jpmckinney’s picture

Indeed, 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?

jpmckinney’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new662 bytes
new543 bytes

All branches affected.

pwolanin’s picture

probably still an issue

nick_vh’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new458 bytes

I'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

nick_vh’s picture

Status: Needs review » Reviewed & tested by the community
nick_vh’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new442 bytes

My bad, left a dsm in there

nick_vh’s picture

Status: Reviewed & tested by the community » Fixed

Committed to both versions

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.