You are here

public function SearchApiFacetapiAdapter::addFacet in Search API 7

Add the given facet to the query.

File

contrib/search_api_facetapi/plugins/facetapi/adapter.inc, line 126
Classes used by the Facet API module.

Class

SearchApiFacetapiAdapter
Facet API adapter for the Search API module.

Code

public function addFacet(array $facet, SearchApiQueryInterface $query) {
  if (isset($this->fields[$facet['name']])) {
    $options =& $query
      ->getOptions();
    $facet_info = $this->fields[$facet['name']];
    if (!empty($facet['query_options'])) {

      // Let facet-specific query options override the set options.
      $facet_info = $facet['query_options'] + $facet_info;
    }
    $options['search_api_facets'][$facet['name']] = $facet_info;
  }
}