[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/modules/search/ -> search.install (source)

   1  <?php
   2  
   3  /**
   4   * Implementation of hook_install().
   5   */
   6  function search_install() {
   7    // Create tables.
   8    drupal_install_schema('search');
   9  }
  10  
  11  /**
  12   * Implementation of hook_uninstall().
  13   */
  14  function search_uninstall() {
  15    // Remove tables.
  16    drupal_uninstall_schema('search');
  17  
  18    variable_del('minimum_word_size');
  19    variable_del('overlap_cjk');
  20    variable_del('search_cron_limit');
  21  }
  22  
  23  /**
  24   * Implementation of hook_schema().
  25   */
  26  function search_schema() {
  27    $schema['search_dataset'] = array(
  28      'description' => 'Stores items that will be searched.',
  29      'fields' => array(
  30        'sid' => array(
  31          'type' => 'int',
  32          'unsigned' => TRUE,
  33          'not null' => TRUE,
  34          'default' => 0,
  35          'description' => 'Search item ID, e.g. node ID for nodes.',
  36        ),
  37        'type' => array(
  38          'type' => 'varchar',
  39          'length' => 16,
  40          'not null' => FALSE,
  41          'description' => 'Type of item, e.g. node.',
  42        ),
  43        'data' => array(
  44          'type' => 'text',
  45          'not null' => TRUE,
  46          'size' => 'big',
  47          'description' => 'List of space-separated words from the item.',
  48        ),
  49        'reindex' => array(
  50          'type' => 'int',
  51          'unsigned' => TRUE,
  52          'not null' => TRUE,
  53          'default' => 0,
  54          'description' => 'Set to force node reindexing.',
  55        ),
  56      ),
  57      'unique keys' => array('sid_type' => array('sid', 'type')),
  58    );
  59  
  60    $schema['search_index'] = array(
  61      'description' => 'Stores the search index, associating words, items and scores.',
  62      'fields' => array(
  63        'word' => array(
  64          'type' => 'varchar',
  65          'length' => 50,
  66          'not null' => TRUE,
  67          'default' => '',
  68          'description' => 'The {search_total}.word that is associated with the search item.',
  69        ),
  70        'sid' => array(
  71          'type' => 'int',
  72          'unsigned' => TRUE,
  73          'not null' => TRUE,
  74          'default' => 0,
  75          'description' => 'The {search_dataset}.sid of the searchable item to which the word belongs.',
  76        ),
  77        'type' => array(
  78          'type' => 'varchar',
  79          'length' => 16,
  80          'not null' => FALSE,
  81          'description' => 'The {search_dataset}.type of the searchable item to which the word belongs.',
  82        ),
  83        'score' => array(
  84          'type' => 'float',
  85          'not null' => FALSE,
  86          'description' => 'The numeric score of the word, higher being more important.',
  87        ),
  88      ),
  89      'indexes' => array(
  90        'sid_type' => array('sid', 'type'),
  91        'word' => array('word')
  92      ),
  93      'unique keys' => array('word_sid_type' => array('word', 'sid', 'type')),
  94    );
  95  
  96    $schema['search_total'] = array(
  97      'description' => 'Stores search totals for words.',
  98      'fields' => array(
  99        'word' => array(
 100          'description' => 'Primary Key: Unique word in the search index.',
 101          'type' => 'varchar',
 102          'length' => 50,
 103          'not null' => TRUE,
 104          'default' => '',
 105        ),
 106        'count' => array(
 107          'description' => "The count of the word in the index using Zipf's law to equalize the probability distribution.",
 108          'type' => 'float',
 109          'not null' => FALSE,
 110        ),
 111      ),
 112      'primary key' => array('word'),
 113    );
 114  
 115    $schema['search_node_links'] = array(
 116      'description' => 'Stores items (like nodes) that link to other nodes, used to improve search scores for nodes that are frequently linked to.',
 117      'fields' => array(
 118        'sid' => array(
 119          'type' => 'int',
 120          'unsigned' => TRUE,
 121          'not null' => TRUE,
 122          'default' => 0,
 123          'description' => 'The {search_dataset}.sid of the searchable item containing the link to the node.',
 124        ),
 125        'type' => array(
 126          'type' => 'varchar',
 127          'length' => 16,
 128          'not null' => TRUE,
 129          'default' => '',
 130          'description' => 'The {search_dataset}.type of the searchable item containing the link to the node.',
 131        ),
 132        'nid' => array(
 133          'type' => 'int',
 134          'unsigned' => TRUE,
 135          'not null' => TRUE,
 136          'default' => 0,
 137          'description' => 'The {node}.nid that this item links to.',
 138        ),
 139        'caption' => array(
 140          'type' => 'text',
 141          'size' => 'big',
 142          'not null' => FALSE,
 143          'description' => 'The text used to link to the {node}.nid.',
 144        ),
 145      ),
 146      'primary key' => array('sid', 'type', 'nid'),
 147      'indexes' => array('nid' => array('nid')),
 148    );
 149  
 150    return $schema;
 151  }
 152  


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7