Hi,

first of all I'd like to thank you for this wonderful module.

I created a view which gives me a date range of filters. I have called the view "date". When I enable the "current search"-block from apache_solr I can see that the facets of my view are shown as date:facet_2 (I guess VIEW_NAME:KEYNO_OF_FACET) instead of the friendly name.

cheers

Comments

xurubo93’s picture

I've found the solution:

You have to insert 2 values in your implementation of hook_apachesolr_facets() apachesolr_facebuilder_apachesolr_facets:
1.) display_callback
2.) field_name

function apachesolr_facetbuilder_apachesolr_facets() {
  $out = array();
  $facets = _apachesolr_facetbuilder_get_facet_fields();
  foreach ($facets as $facet_field => $info) {
    $out[$facet_field] = array(
      'info' => t('Apache Solr Facet Builder: '. $info['facet_field_title'] . ' ('.$info['view']->name.')'),
      'facet_field' => $facet_field,
      'display_callback'  => 'apachesolr_facetbuilder_facet_name',
      'field_name' => $facet_field,
    );
  }
  return $out;
}

Please consider it when committing the next update.

ronan’s picture

Thanks for tracking this down. Can you tell me what version of Solr and what version of Drupal ApacheSolr module you're using? I haven't experienced this in our setups and would like to reproduce it before making the change.

xurubo93’s picture

I'm using the newest dev-version apachesolr-6.x-2.x-dev (2010-Jul-26) as Drupal module and I have setup solr 1.4.0 on my server.
Cheers

ronan’s picture

Thanks for the info. I'll try switching my local dev copies over and see if I can reproduce it.

mtsanford’s picture

StatusFileSize
new763 bytes

I was getting the same problem with 6.x-2.0-beta3 of apachersolr. I was also getting "Illegal offset type" PHP errors.

This patch appears to fix the problem it. I don't know if this is due to a change in the $facet argument passed to the theme by the apachesolr module, as the PHP error happened during theming according to the call stack:

apachesolr_facetbuilder_facet_name (Array, 4 elements)
theme_apachesolr_breadcrumb_facet (Array, 2 elements)
call_user_func_array (Array, 4 elements)
theme (Array, 4 elements)
apachesolr_search_nested_facet_items (Array, 4 elements)
apachesolr_search_currentsearch_block (Array, 4 elements)

....etc

mtsanford’s picture

StatusFileSize
new916 bytes

New patch. That one broke the main facetbuilder block's facet names.