You are here

function apachesolr_search_get_fields in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 apachesolr_search.admin.inc \apachesolr_search_get_fields()
  2. 7 apachesolr_search.admin.inc \apachesolr_search_get_fields()

Menu callback - the settings form.

1 call to apachesolr_search_get_fields()
apachesolr_bias_settings_page in ./apachesolr_search.admin.inc
Menu callback - Bias settings form.

File

./apachesolr_search.admin.inc, line 684
Administrative settings for searching.

Code

function apachesolr_search_get_fields($environment = NULL) {
  if (empty($environment)) {
    $env_id = apachesolr_default_environment();
    $environment = apachesolr_environment_load($env_id);
  }
  $env_id = $environment['env_id'];

  // Try to fetch the schema fields.
  try {
    $solr = apachesolr_get_solr($env_id);
    $fields = $solr
      ->getFields();
    return $fields;
  } catch (Exception $e) {
    watchdog('Apache Solr', nl2br(check_plain($e
      ->getMessage())), NULL, WATCHDOG_ERROR);
    drupal_set_message(nl2br(check_plain($e
      ->getMessage())), 'warning');
    drupal_set_message(t('Cannot get information about the fields in the index.'), 'warning');
  }
}