You are here

public function ApacheSolrFacetapiGeo::build in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 plugins/facetapi/query_type_geo.inc \ApacheSolrFacetapiGeo::build()
  2. 7 plugins/facetapi/query_type_geo.inc \ApacheSolrFacetapiGeo::build()

Initializes the facet's build array.

Return value

array The initialized render array.

Overrides FacetapiQueryTypeInterface::build

File

plugins/facetapi/query_type_geo.inc, line 70

Class

ApacheSolrFacetapiGeo
Plugin for "apachesolr_geo" query types.

Code

public function build() {
  $build = array();
  if ($response = apachesolr_static_response_cache($this->adapter
    ->getSearcher())) {
    if (isset($response->facet_counts->facet_queries)) {
      foreach ($response->facet_counts->facet_queries as $value => $count) {

        // Skip zero results values.
        if ($count > 0) {
          $build[$value] = array(
            '#count' => $count,
          );
        }
      }
    }
  }
  return $build;
}