You are here

function apachesolr_install in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 apachesolr.install \apachesolr_install()
  2. 5.2 apachesolr.install \apachesolr_install()
  3. 6 apachesolr.install \apachesolr_install()
  4. 6.2 apachesolr.install \apachesolr_install()
  5. 7 apachesolr.install \apachesolr_install()

Implements hook_install().

File

./apachesolr.install, line 62
Install and related hooks for apachesolr_search.

Code

function apachesolr_install() {
  drupal_load('module', 'content');
  module_load_include('inc', 'apachesolr', 'apachesolr_search.admin');
  module_load_include('module', 'apachesolr', 'apachesolr');
  module_load_include('inc', 'apachesolr', 'apachesolr.index');

  // Create tables.
  drupal_install_schema('apachesolr');

  // Create one MLT block.
  apachesolr_search_mlt_save_block(array(
    'name' => t('More like this'),
  ));

  // Insert our default environment
  db_query("INSERT INTO {apachesolr_environment} (env_id, name, url, service_class)\n     VALUES ('%s', '%s', '%s', '%s')", array(
    'solr',
    'localhost server',
    'http://localhost:8983/solr',
    '',
  ));

  // Initialize the entities to index. We enable all node types by default
  $env_id = apachesolr_default_environment();
  $bundles = content_types();
  apachesolr_index_set_bundles($env_id, 'node', array_keys($bundles));
  drupal_set_message(t('Apache Solr is installed. Visit the <a href="@settings_link">settings page</a>.', array(
    '@settings_link' => url('admin/settings/apachesolr'),
  )));
}