see: http://drupal.org/node/823854

ideally we should have a more generic hook that can alter documented created from or related to a specific node.

For 6.x-1.x I'm not sure sure a change is in scope - we could basiclaly use hook_apachesolr_update_index() if we indicate that modules implementing it may need to check $document->entity to decide whether to act, and maybe pass $entity as an optional third parameter?

Comments

nick_vh’s picture

I vote in favor and to change the apachesolr_entity_to_document while supplying this function with the name of the entity type.
The hook should be able to catch which entity type it is handling to properly get the fields which it needs to index.

This would make a more reusable approach.

function apachesolr_search_apachesolr_document_handlers($type, $namespace) {
  if ($type == 'node' && $namespace == 'apachesolr_search') {
    return array('apachesolr_node_to_document');
  } else if($namespace == 'apachesolr_search') {
    //somehow add this parameter of the entitytype
    return array('apachesolr_entity_to_document');
 }
}

(code example for D7)

pwolanin’s picture

For Drupal 7, we have multi-entity indexing code that needs to be integrated. It's possible someone could backport that scheme if it works well.

pwolanin’s picture

Status: Active » Closed (duplicate)
jpmckinney’s picture

Duplicate of what? Good practice to link to node which it is duplicate of, and to link that node back to this issue.

scor’s picture