function search_api_schema in Search API 7
Same name and namespace in other branches
- 8 search_api.install \search_api_schema()
Implements hook_schema().
File
- ./
search_api.install, line 11 - Install, update and uninstall functions for the Search API module.
Code
function search_api_schema() {
$schema['search_api_server'] = array(
'description' => 'Stores all search servers created through the Search API.',
'fields' => array(
'id' => array(
'description' => 'The primary identifier for a server.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => 'The displayed name for a server.',
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'machine_name' => array(
'description' => 'The machine name for a server.',
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'description' => array(
'description' => 'The displayed description for a server.',
'type' => 'text',
'not null' => FALSE,
),
'class' => array(
'description' => 'The id of the service class to use for this server.',
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'options' => array(
'description' => 'The options used to configure the service object.',
'type' => 'text',
'size' => 'medium',
'serialize' => TRUE,
'not null' => TRUE,
),
'enabled' => array(
'description' => 'A flag indicating whether the server is enabled.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
'status' => array(
'description' => 'The exportable status of the entity.',
'type' => 'int',
'not null' => TRUE,
'default' => 0x1,
'size' => 'tiny',
),
'module' => array(
'description' => 'The name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'indexes' => array(
'enabled' => array(
'enabled',
),
),
'unique keys' => array(
'machine_name' => array(
'machine_name',
),
),
'primary key' => array(
'id',
),
);
$schema['search_api_index'] = array(
'description' => 'Stores all search indexes on a {search_api_server}.',
'fields' => array(
'id' => array(
'description' => 'An integer identifying the index.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => 'A name to be displayed for the index.',
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'machine_name' => array(
'description' => 'The machine name of the index.',
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'description' => array(
'description' => "A string describing the index' use to users.",
'type' => 'text',
'not null' => FALSE,
),
'server' => array(
'description' => 'The {search_api_server}.machine_name with which data should be indexed.',
'type' => 'varchar',
'length' => 50,
'not null' => FALSE,
),
'item_type' => array(
'description' => 'The type of items stored in this index.',
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'options' => array(
'description' => 'An array of additional arguments configuring this index.',
'type' => 'text',
'size' => 'medium',
'serialize' => TRUE,
'not null' => TRUE,
),
'enabled' => array(
'description' => 'A flag indicating whether this index is enabled.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
'read_only' => array(
'description' => 'A flag indicating whether to write to this index.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'status' => array(
'description' => 'The exportable status of the entity.',
'type' => 'int',
'not null' => TRUE,
'default' => 0x1,
'size' => 'tiny',
),
'module' => array(
'description' => 'The name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'indexes' => array(
'item_type' => array(
'item_type',
),
'server' => array(
'server',
),
'enabled' => array(
'enabled',
),
),
'unique keys' => array(
'machine_name' => array(
'machine_name',
),
),
'primary key' => array(
'id',
),
);
$schema['search_api_item'] = array(
'description' => 'Stores the items which should be indexed for each index, and their status.',
'fields' => array(
'item_id' => array(
'description' => "The item's entity id (e.g. {node}.nid for nodes).",
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'index_id' => array(
'description' => 'The {search_api_index}.id this item belongs to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'changed' => array(
'description' => 'Either a flag or a timestamp to indicate if or when the item was changed since it was last indexed.',
'type' => 'int',
'size' => 'big',
'not null' => TRUE,
'default' => 1,
),
),
'indexes' => array(
'indexing' => array(
'index_id',
'changed',
),
),
'primary key' => array(
'item_id',
'index_id',
),
);
$schema['search_api_item_string_id'] = array(
'description' => 'Stores the items which should be indexed for each index, and their status. Used only for items with string IDs.',
'fields' => array(
'item_id' => array(
'description' => "The item's ID.",
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
),
'index_id' => array(
'description' => 'The {search_api_index}.id this item belongs to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'changed' => array(
'description' => 'Either a flag or a timestamp to indicate if or when the item was changed since it was last indexed.',
'type' => 'int',
'size' => 'big',
'not null' => TRUE,
'default' => 1,
),
),
'indexes' => array(
'indexing' => array(
'index_id',
'changed',
),
),
'primary key' => array(
'item_id',
'index_id',
),
);
$schema['search_api_task'] = array(
'description' => 'Stores pending tasks for servers.',
'fields' => array(
'id' => array(
'description' => 'An integer identifying this task.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'server_id' => array(
'description' => 'The {search_api_server}.machine_name for which this task should be executed.',
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'type' => array(
'description' => 'A keyword identifying the type of task that should be executed.',
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'index_id' => array(
'description' => 'The {search_api_index}.machine_name to which this task pertains, if applicable for this type.',
'type' => 'varchar',
'length' => 50,
'not null' => FALSE,
),
'data' => array(
'description' => 'Some data needed for the task, might be optional depending on the type.',
'type' => 'text',
'size' => 'medium',
'serialize' => TRUE,
'not null' => FALSE,
),
),
'indexes' => array(
'server' => array(
'server_id',
),
),
'primary key' => array(
'id',
),
);
return $schema;
}