function apachesolr_update_6000 in Apache Solr Search 6
Same name and namespace in other branches
- 6.2 apachesolr.install \apachesolr_update_6000()
Create node indexing table.
File
- ./
apachesolr.install, line 164 - Install and related hooks for apachesolr_search.
Code
function apachesolr_update_6000() {
// Create table.
$ret = array();
$schema['apachesolr_search_node'] = array(
'description' => t('Stores a record of when a node property changed to determine if it needs indexing by Solr.'),
'fields' => array(
'nid' => array(
'description' => t('The primary identifier for a node.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'status' => array(
'description' => t('Boolean indicating whether the node is published (visible to non-administrators).'),
'type' => 'int',
'not null' => TRUE,
'default' => 1,
),
'changed' => array(
'description' => t('The Unix timestamp when a node property was changed.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'changed' => array(
'changed',
'status',
),
),
'primary key' => array(
'nid',
),
);
db_create_table($ret, 'apachesolr_search_node', $schema['apachesolr_search_node']);
// Populate table
$ret[] = update_sql("INSERT INTO {apachesolr_search_node} (nid, status, changed)\n SELECT n.nid, n.status, GREATEST(n.created, n.changed, COALESCE(c.last_comment_timestamp, 0)) AS changed\n FROM {node} n LEFT JOIN {apachesolr_search_node} asn ON n.nid = asn.nid\n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid\n WHERE asn.changed IS NULL");
return $ret;
}