You are here

function suggestion_schema in Autocomplete Search Suggestions 3.0.x

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

Implements hook_schema().

File

./suggestion.install, line 11
Contains suggestion.install.

Code

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