You are here

facetapi_luceneapi.install in Facet API 6

Installation functions for the Search Lucene API Facet Adapter module.

File

contrib/facetapi_luceneapi/facetapi_luceneapi.install
View source
<?php

/**
 * @file
 * Installation functions for the Search Lucene API Facet Adapter module.
 */

/**
 * Implementation of hook_install().
 */
function facetapi_luceneapi_install() {
  drupal_install_schema('facetapi_luceneapi');
}

/**
 * Implementation of hook_uninstall().
 */
function facetapi_luceneapi_uninstall() {
  drupal_uninstall_schema('facetapi_luceneapi');

  // Removed "termfreqs_cached" variable for all fields.
  $variable = 'facetapi:termfreqs_cached:' . $form['storage']['#value']['searcher'] . ':%%';
  if ($result = db_query("SELECT name FROM {variable} WHERE name LIKE '{$variable}'")) {
    while ($record = db_fetch_object($result)) {
      variable_del($record->name);
    }
  }
}

/**
 * Implementation of hook_schema().
 */
function facetapi_luceneapi_schema() {
  $schema = array();
  $schema['luceneapi_node_termfreqs'] = array(
    'description' => 'Cached Search Lucene API term frequencies.',
    'fields' => array(
      'term' => array(
        'description' => 'A string containing the term being searched.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'field' => array(
        'description' => 'A string containing the name of the Lucene field.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'termfreqs' => array(
        'description' => 'An array of document IDs the term is found in.',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ),
    ),
    'indexes' => array(
      'term' => array(
        'term',
      ),
      'field' => array(
        'field',
      ),
    ),
    'primary key' => array(
      'term',
      'field',
    ),
  );
  return $schema;
}

Functions

Namesort descending Description
facetapi_luceneapi_install Implementation of hook_install().
facetapi_luceneapi_schema Implementation of hook_schema().
facetapi_luceneapi_uninstall Implementation of hook_uninstall().