[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

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

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


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7