When I enable the Slider facet on a price field, this notice appears on the search results page:

Notice: Undefined index: name in apachesolr_index_key() (line 1681 of /var/www/drupal/greaves/public_html_module/sites/all/modules/contrib/apachesolr/apachesolr.module).

If I debug the $field variable in the apachesolr_index_key function, there is no 'name' in the field array. From this the $type_prefix is always set to 's' and the subsequent 'substr' fails.

Any ideas?

Comments

shailu29’s picture

I am also getting this same error when I create custom facet.

ymakux’s picture

I faced the same problem. It seems nothing wrong with Slider module, you have to implement hook_facetapi_facet_info() properly if you use custom field

working example

My custom field (added via hook_apachesolr_index_documents_alter()) - iss_commerce_price_average This is numeric single field

function mymodule_facetapi_facet_info($searcher_info) {
  $facets = array();
  if ('apachesolr' == $searcher_info['adapter']) {
    $facets['iss_commerce_price_average'] = array(
      'field' => 'iss_commerce_price_average', 
      'label' => t('Price'), 
      'description' => t('Product price'),
      'query types' => array('numeric_range'),
      'map options' => array(
      'field' => array(
        'type' => 'number_integer'
      ),
      'index_type' => 'sint',
      'name' => 'commerce_price_average', // important part
    )
    );
  }
  return $facets;
}