I wanted to add a new mapping for a custom CCK field and therefore implemented hook_apachesolr_cck_fields_alter:
/**
* Implementation of hook_apachesolr_cck_fields_alter().
*/
function simple_duration_apachesolr_cck_fields_alter(&$mappings) {
$mappings['simple_duration'] = array(
'simple_duration' => array(
'indexing_callback' => 'simple_duration_indexing_callback',
'display_callback' => 'simple_duration_display_callback',
'index_type' => 'string',
'facets' => TRUE,
),
);
}
By using this code the function apachesolr_search_apachesolr_facets in apachesolr_search.module throws an error in line 691. The key 'field_type' of the variable $field is not set. By changig it to 'type' everything works fine.
Is there a bug or am I using the hook wrong?
Comments
Comment #1
jpmckinney commentedfield_type is taken from the CCK description of the field. Make sure you are implementing CCK hooks correctly.
Comment #3
Andrey Zakharov commentedSame issue here
a lot of
WD php: Notice: Undefined index: field_type in apachesolr_search_apachesolr_facets() (line 755 of [error]
/sites/all/modules/drupal-contrib/apachesolr/apachesolr_search.module).
fields are type=>nodereference
in fact, 'field_type' added in content_preprocess_content_field which has been called before theming field?
content.module:2463
so, 'type' is primary origin.
Comment #4
jhedstromAndrey is correct,
field_typeisn't added until that preprocessor is run. Internally, CCK tends to usetypeinstead. Attached is a simple patch to use type instead of field_type.Comment #5
bwood commentedAbove patch fixed the problem for me. Thanks.
Comment #6
nick_vhThe 6.x-2.x version has been deprecated. Moving this to 6.x-1.x-dev
Comment #8
nick_vhSince this does not apply to 6.x-1.x I am closing it