You are here

function apachesolr_settings in Apache Solr Search 5

Same name and namespace in other branches
  1. 8 apachesolr.admin.inc \apachesolr_settings()
  2. 5.2 apachesolr.admin.inc \apachesolr_settings()
  3. 6.3 apachesolr.admin.inc \apachesolr_settings()
  4. 6 apachesolr.admin.inc \apachesolr_settings()
  5. 6.2 apachesolr.admin.inc \apachesolr_settings()
  6. 7 apachesolr.admin.inc \apachesolr_settings()
1 string reference to 'apachesolr_settings'
apachesolr_menu in ./apachesolr.module
Implementation of hook_menu().

File

./apachesolr.module, line 68
Integration with the Apache Solr search application.

Code

function apachesolr_settings() {
  $form = array();

  //perform a check to ensure the server is there
  $requirements = apachesolr_requirements('runtime');
  $status = $requirements['apachesolr']['severity'] == 2 ? 'error' : 'status';
  drupal_set_message($requirements['apachesolr']['value'], $status);
  $form['apachesolr_host'] = array(
    '#type' => 'textfield',
    '#title' => t('Solr host name'),
    '#default_value' => variable_get('apachesolr_host', 'localhost'),
    '#description' => t('Host name of your Solr server, e.g. <code>localhost</code> or <code>example.com</code>.'),
  );
  $form['apachesolr_port'] = array(
    '#type' => 'textfield',
    '#title' => t('Solr port'),
    '#default_value' => variable_get('apachesolr_port', '8983'),
    '#description' => t('Port on which the Solr server listens. Tomcat is 8080 by default.'),
  );
  $form['apachesolr_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Solr path'),
    '#default_value' => variable_get('apachesolr_path', '/solr'),
    '#description' => t('Path that identifies the Solr request handler to be used. Leave this as /solr for now.'),
  );
  $options = array();
  foreach (array(
    5,
    10,
    15,
    20,
    25,
    30,
    40,
    50,
    60,
    70,
    80,
    90,
    100,
  ) as $option) {
    $options[$option] = $option;
  }
  $form['apachesolr_rows'] = array(
    '#type' => 'select',
    '#title' => t('Results per page'),
    '#default_value' => variable_get('apachesolr_rows', 10),
    '#options' => $options,
    '#description' => t('The number of results that will be shown per page.'),
  );
  $form['apachesolr_failure'] = array(
    '#type' => 'select',
    '#title' => t('On failure'),
    '#options' => array(
      'show_error' => t('Show error'),
      'show_drupal_results' => t('Show core Drupal results'),
      'show_no_results' => t('Show no results'),
    ),
    '#default_value' => variable_get('apachesolr_failure', 'show_error'),
    '#description' => t('What to display if ApacheSolr search is not available.'),
  );
  return system_settings_form($form);
}