You are here

function apachesolr_index_action_form in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 8 apachesolr.admin.inc \apachesolr_index_action_form()
  2. 6.3 apachesolr.admin.inc \apachesolr_index_action_form()
  3. 7 apachesolr.admin.inc \apachesolr_index_action_form()

Create a form for deleting the contents of the Solr index.

See also

apachesolr_index_action_form_submit()

1 string reference to 'apachesolr_index_action_form'
apachesolr_index_page in ./apachesolr.admin.inc
Gets information about the fields already in solr index.

File

./apachesolr.admin.inc, line 369
Administrative pages for the Apache Solr framework.

Code

function apachesolr_index_action_form() {
  $form = array();
  $form['action'] = array(
    '#value' => '<h3>' . t('Index Actions') . '</h3>',
  );

  // Jump through some forms hoops to get a description under each radio button.
  $actions = array(
    'remaining' => array(
      'title' => t('Index queued content'),
      'description' => t('Any content that is queued for indexing will be submitted to Solr immediately. Depending on amount of content on the site, it may take a long time to complete, and may place an increased load on your server.'),
    ),
    'reindex' => array(
      'title' => t('Queue content for reindexing'),
      'description' => t('All content on the site will be queued for indexing. The documents currently in the Solr index will remain searchable. The content will be gradually resubmitted to Solr during cron runs.'),
    ),
    'delete' => array(
      'title' => t('Delete the index'),
      'description' => t('All documents in the Solr index will be deleted. This is rarely necessary unless your index is corrupt or you have installed a new schema.xml. After doing this your content will need to be resubmitted for indexing.'),
    ),
  );
  foreach ($actions as $key => $action) {

    // Generate the parents as the autogenerator does, so we will have a
    // unique id for each radio button.
    $form['action'][$key] = array(
      '#type' => 'radio',
      '#title' => $action['title'],
      '#default_value' => 'remaining',
      '#return_value' => $key,
      '#parents' => array(
        'action',
      ),
      '#description' => $action['description'],
      '#id' => form_clean_id('edit-' . implode('-', array(
        'action',
        $key,
      ))),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Begin'),
    '#submit' => array(
      'apachesolr_index_action_form_submit',
    ),
  );
  return $form;
}