You are here

function apachesolr_mlt_get_fields in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 5.2 apachesolr.admin.inc \apachesolr_mlt_get_fields()
  2. 5 contrib/apachesolr_mlt/apachesolr_mlt.module \apachesolr_mlt_get_fields()
  3. 6 apachesolr.admin.inc \apachesolr_mlt_get_fields()

Constructs a list of field names used on the settings form.

Return value

array An array containing a the fields in the solr instance.

1 call to apachesolr_mlt_get_fields()
apachesolr_mlt_block_form in ./apachesolr.admin.inc
Form to edit moreLikeThis block settings.

File

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

Code

function apachesolr_mlt_get_fields() {
  $rows = array();
  try {
    $solr = apachesolr_get_solr();
    $fields = $solr
      ->getFields();
    foreach ($fields as $field_name => $field) {
      if ($field->schema[4] == 'V') {
        $rows[$field_name] = apachesolr_field_name_map($field_name);
      }
    }
    ksort($rows);
  } catch (Exception $e) {
    watchdog('Apache Solr', nl2br(check_plain($e
      ->getMessage())), NULL, WATCHDOG_ERROR);
    drupal_set_message(nl2br(check_plain($e
      ->getMessage())), "warning");
  }
  return $rows;
}