function apachesolr_index_get_entities_to_index in Apache Solr Search 8
Same name and namespace in other branches
- 6.3 apachesolr.index.inc \apachesolr_index_get_entities_to_index()
- 7 apachesolr.index.inc \apachesolr_index_get_entities_to_index()
Returns an array of rows from a query based on an indexing environment. @todo Remove the read only because it is not environment specific
Parameters
$env_id:
$entity_type:
$limit:
Return value
array list of row to index
3 calls to apachesolr_index_get_entities_to_index()
- apachesolr_drush_solr_get_next_indexed in drush/
apachesolr.drush.inc - apachesolr_get_nodes_to_index in ./
apachesolr.module - Function to retrieve all the nodes to index. Deprecated but kept for backwards compatibility
- apachesolr_index_entities in ./
apachesolr.index.inc - Processes all index queues associated with the passed environment.
File
- ./
apachesolr.index.inc, line 479 - Functions related to Apache Solr indexing operations.
Code
function apachesolr_index_get_entities_to_index($env_id, $entity_type, $limit) {
$rows = array();
if (variable_get('apachesolr_read_only', 0)) {
return $rows;
}
$bundles = apachesolr_get_index_bundles($env_id, $entity_type);
if (empty($bundles)) {
return $rows;
}
$query = _apachesolr_index_get_next_set_query($env_id, $entity_type);
$query
->range(0, $limit);
$records = $query
->execute();
$status_callbacks = apachesolr_entity_get_callback($entity_type, 'status callback');
foreach ($records as $record) {
// Check status and status callbacks before sending to the index
if (is_array($status_callbacks)) {
foreach ($status_callbacks as $status_callback) {
if (is_callable($status_callback)) {
// by placing $status in front we prevent calling any other callback
// after one status callback returned false
$record->status = $record->status && $status_callback($record->entity_id, $record->entity_type);
}
}
}
$rows[] = $record;
}
return $rows;
}