I'm using the Apache Solr Search Integration and Facet API modules. I'm trying to implement facets for custom fields publication_date
, publication_author
, and journal
, which are part of the content type publication
.
These 3 fields are indexed successfully as ss_date
, ss_author
, and ss_journal
. Furthermore, I can search against these fields on the default apachesolr search page. However, the facets for these fields show up as "_empty_". For example, when the search page loads, under the "publication_author" facet header, one bullet item shows up as "_empty_ (10)", which to me means that the author field is being indexed successfully with value "NULL" or possibly literally "_empty_" for all 10 publication nodes. Code is below for just the author facet.
define custom facets
function HOOK_facetapi_facet_info(array $searcher_info) {
$facets = array();
// Facets are usually associated with the type of content stored in the index.
if (isset($searcher_info['types']['node'])) {
$facets['ss_author'] = array(
'name' => 'ss_author',
'label' => t('custom: author'),
'description' => t('Shows the authors'),
'field' => 'ss_author',
'dependency plugins' => array('role'),
'default widget' => 'links',
'allowed operators' => array(FACETAPI_OPERATOR_AND => TRUE, FACETAPI_OPERATOR_OR => TRUE),
'facet missing allowed' => FALSE,
'facet mincount allowed' => FALSE,
//'map callback' => 'not used for now',
'max callback' => FALSE,
'default sorts' => array(
array('active', SORT_DESC),
array('count', SORT_DESC),
array('display', SORT_ASC),
),
);
}
return $facets;
}
"ss_author" is the name of the field added to the ApacheSolr document during indexing. If you'd like the code used to actually index these fields, let me know. Thanks very much!