You are here

function apachesolr_get_nodes_to_index in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 8 apachesolr.module \apachesolr_get_nodes_to_index()
  2. 5.2 apachesolr.module \apachesolr_get_nodes_to_index()
  3. 6.3 apachesolr.module \apachesolr_get_nodes_to_index()
  4. 6 apachesolr.module \apachesolr_get_nodes_to_index()
  5. 7 apachesolr.module \apachesolr_get_nodes_to_index()

Returns an array of rows from a query based on an indexing namespace.

Parameters

string $namespace: Usually the calling module. Is used as a clue for other modules when they decide whether to create extra $documents, and is used to track the last_index timestamp.

$limit: The number of items to return.

Return value

array An associative array containing:

  • nid
  • changed
2 calls to apachesolr_get_nodes_to_index()
apachesolr_batch_index_nodes in ./apachesolr.admin.inc
Batch Operation Callback
apachesolr_search_cron in ./apachesolr_search.module
Implementation of hook_cron(). Indexes nodes.

File

./apachesolr.module, line 391
Integration with the Apache Solr search application.

Code

function apachesolr_get_nodes_to_index($namespace, $limit) {
  $rows = array();
  if (variable_get('apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
    return $rows;
  }
  list($excluded_types, $args, $join_sql, $exclude_sql) = apachesolr_exclude_types($namespace);
  $result = db_query_range("SELECT asn.nid, asn.changed FROM {apachesolr_search_node} asn " . $join_sql . "WHERE (asn.changed > %d OR (asn.changed = %d AND asn.nid > %d)) AND asn.status = 1 " . $exclude_sql . "ORDER BY asn.changed ASC, asn.nid ASC", $args, 0, $limit);
  while ($row = db_fetch_object($result)) {
    $rows[] = $row;
  }
  return $rows;
}