You are here

function search_api_facetapi_facetapi_searcher_info in Search API 7

Implements hook_facetapi_searcher_info().

File

contrib/search_api_facetapi/search_api_facetapi.module, line 52
Integrates the Search API with the Facet API.

Code

function search_api_facetapi_facetapi_searcher_info() {
  $info = array();
  $indexes = search_api_index_load_multiple(FALSE);
  foreach ($indexes as $index) {
    if (_search_api_facetapi_index_support_feature($index)) {
      $searcher_name = 'search_api@' . $index->machine_name;
      $info[$searcher_name] = array(
        'label' => t('Search service: @name', array(
          '@name' => $index->name,
        )),
        'adapter' => 'search_api',
        'instance' => $index->machine_name,
        'types' => array(
          $index->item_type,
        ),
        'path' => '',
        'supports facet missing' => TRUE,
        'supports facet mincount' => TRUE,
        'include default facets' => FALSE,
      );
      if (($entity_type = $index
        ->getEntityType()) && $entity_type !== $index->item_type) {
        $info[$searcher_name]['types'][] = $entity_type;
      }
    }
  }
  return $info;
}