You are here

function apachesolr_index_node_status_callback in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 apachesolr.index.inc \apachesolr_index_node_status_callback()
  2. 7 apachesolr.index.inc \apachesolr_index_node_status_callback()

Status callback for ApacheSolr, for nodes. after indexing a certain amount of nodes

Parameters

$entity_id:

$entity_type:

$entity: In the case where the status is being checked while the entity is being saved, this contains the full entity object. In other cases, it will be NULL.

Return value

int The status of the node

2 string references to 'apachesolr_index_node_status_callback'
apachesolr_entity_info_alter in ./apachesolr.module
Implements hook_entity_info_alter().
hook_apachesolr_entity_info_alter in ./apachesolr.api.php
Add information to index other entities. There are some modules in http://drupal.org that can give a good example of custom entity indexing such as apachesolr_user, apachesolr_term

File

./apachesolr.index.inc, line 977
Functions related to Apache Solr indexing operations.

Code

function apachesolr_index_node_status_callback($entity_id, $entity_type, $entity = NULL) {
  if ($entity === NULL) {
    $entity = entity_load($entity_type, array(
      $entity_id,
    ));
    $entity = $entity ? reset($entity) : FALSE;
  }
  if (empty($entity)) {

    // If the object failed to load, just stop.
    return FALSE;
  }

  // Make sure we have an integer value.
  // Anything different from 1 becomes zero
  return $entity->status == 1 ? 1 : 0;
}