You are here

function panopoly_search_enable_solr in Panopoly Search 7

Helper function to enable Solr server and index.

2 calls to panopoly_search_enable_solr()
panopoly_search_modules_enabled in ./panopoly_search.module
Implementation of hook_modules_enabled()
panopoly_search_pantheon_apachesolr_post_schema_form_submit in ./panopoly_search.module
Submit callback for pantheon_apachesolr_post_schema_form_submit().

File

./panopoly_search.module, line 45

Code

function panopoly_search_enable_solr() {

  // Enable Panopoly's Solr server and index.
  require_once drupal_get_path('module', 'search_api') . '/search_api.admin.inc';
  $solr_server = search_api_server_load('solr_server');
  $solr_server
    ->update(array(
    'enabled' => 1,
  ));
  $solr_index = search_api_index_load('node_index');
  $solr_index
    ->update(array(
    'server' => 'solr_server',
    'enabled' => 1,
  ));

  // Clear index and rebuild.
  $solr_index
    ->clear();
  $solr_index
    ->reindex();
}