Custom facets return no results on search page I have created a custom field to the node index of apache solr. Here is the code.

function myModule_apachesolr_index_document_build_node(ApacheSolrDocument $document, $node, $env_id) {
  if($node-&gt;type == "feature") {
    $support = db_select("custom_table", 'a')
        -&gt;fields("a", array('Support'))
        -&gt;condition('nid', $node-&gt;nid)
        -&gt;execute()-&gt;fetchField();
      $document-&gt;addField('custom_field', $support);
  }
}


And then for this custom field I have created the facet. Here is the code.

function myModule_facetapi_facet_info(array $searcher_info) {
  $facets = array();
     $facets['custom_abot_support'] = array(
      'label' =&gt; t('Custom Facet'),
      'description' =&gt; t('Filters by Support'),
      'field' =&gt; 'custom_field'
    );
}


The facet successfully created and it has been present in the facets list. But the problem is on the search page. When I try to search some thing, on the search results page this facet only display the title of the facet block. It does not display any content.

Any one what is the problem?
I have found the solution.


if you wrote this hook hook_apachesolr_index_document_build_node then
you have to delete the indexed data from apache solr search index and
then reindex all the data. if you only reindex data then it will not
work.
and 2nd point. you have to keep care of the prefixes of the field. if it is a single string then use ss if multivalue field then use sm
3rd point is you have to call hook_apachesolr_query_alter.

function myModule_apachesolr_query_alter($query){
   $query-&gt;addParams(array('fl' =&gt; array('ss_custom_field')));


}