You are here

function apachesolr_install in Apache Solr Search 7

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

Implements hook_install().

File

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

Code

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

  // Create one MLT block.
  apachesolr_search_mlt_save_block(array(
    'name' => st('More like this'),
  ));
  db_insert('apachesolr_environment')
    ->fields(array(
    'env_id' => 'solr',
    'name' => 'localhost server',
    'url' => 'http://localhost:8983/solr',
  ))
    ->execute();

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