You are here

static function Solr_Base_Query::get_fields_in_index in Apache Solr Search 5

Luke query to find out what fields the Lucene index already knows about. TODO: Does this belong in this class? Or in a Service class? Or in the module itself?

3 calls to Solr_Base_Query::get_fields_in_index()
apachesolr_index_page in ./apachesolr.module
apachesolr_mlt_get_fields in contrib/apachesolr_mlt/apachesolr_mlt.module
function apachesolr_mlt_get_fields() A list of field names used on the settings form.
Solr_Base_Query::parse_query in ./Solr_Base_Query.php

File

./Solr_Base_Query.php, line 9

Class

Solr_Base_Query

Code

static function get_fields_in_index() {
  static $fields;
  if (empty($fields)) {

    // TODO: The apachesolr_base_url() is the only dependency on the module. Make it a static
    // class method?
    $response = drupal_http_request(apachesolr_base_url() . "/admin/luke?numTerms=0&wt=json");
    if ($response->code == '200') {
      $data = json_decode($response->data);
    }
  }
  return $data->fields;
}