You are here

function suggestion_schema in Autocomplete Search Suggestions 7

Same name and namespace in other branches
  1. 8.2 suggestion.install \suggestion_schema()
  2. 8 suggestion.install \suggestion_schema()
  3. 3.0.x suggestion.install \suggestion_schema()

Implements hook_schema().

File

./suggestion.install, line 43
The installation file for the suggestion module.

Code

function suggestion_schema() {
  $schema['suggestion'] = array(
    'description' => 'Suggestion data.',
    'fields' => array(
      'ngram' => array(
        'description' => "The suggestion string.",
        'type' => 'varchar',
        'length' => 65,
        'binary' => TRUE,
        'not null' => TRUE,
      ),
      'src' => array(
        'description' => "Suggestion source bitmap: 0 = disabled, 1 = content, 2 = surfer, 4 = priority",
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'atoms' => array(
        'description' => "The number of words in this suggestion.",
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'qty' => array(
        'description' => "The number of instances.",
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'density' => array(
        'description' => "The weighted average.",
        'type' => 'float',
        'unsigned' => TRUE,
        'precision' => 3,
        'not null' => TRUE,
        'default' => 1.0,
      ),
    ),
    'indexes' => array(
      'src' => array(
        'src',
      ),
    ),
    'unique keys' => array(
      'ngram_atom_src' => array(
        'src',
        'atoms',
        'ngram',
      ),
      'ngram_atom_density' => array(
        'density',
        'ngram',
        'atoms',
      ),
    ),
    'primary key' => array(
      'ngram',
    ),
  );
  return $schema;
}