public function getFacets() {
		if ($this->returnedFacets) {
			return $this->returnedFacets;
		}
		
		$result = $this->getResult();
		if (!isset($result->facet_counts)) {
			return;
		}

		if (isset($result->facet_counts->exception)) {
			// $this->logger->error($result->facet_counts->exception)
			return array();
		}
		
		$elems = $result->facet_counts->facet_fields;
		
		$facets = array();
		foreach ($elems as $field => $values) {
			$elemVals = array();
			foreach ($values as $vname => $vcount) {
				if ($vname == '_empty_') {
					continue;
				}
				$r = new stdClass;
				$r->Name = $vname;
				$r->Query = $vname;
				$r->Count = $vcount;
				$elemVals[] = $r;
			}
			$facets[$field] = $elemVals;
		}
		
		// see if there's any query facets for things too
		$query_elems = $result->facet_counts->facet_queries;
		if ($query_elems) {
			foreach ($query_elems as $vname => $count) {
				if ($vname == '_empty_') {
					continue;
				}
				
				list($field, $query) = explode(':', $vname);

				$r = new stdClass;
				$r->Type = 'query';
				$r->Name = $vname;
				$r->Query = $query;
				$r->Count = $count;
				
				$existing = isset($facets[$field]) ? $facets[$field] : array();
				$existing[] = $r;
				$facets[$field] = $existing;
			}
		}
		
		$this->returnedFacets = $facets;
		return $this->returnedFacets;
	}
public function getFacets() {
		if ($this->returnedFacets) {
			return $this->returnedFacets;
		}
		
		$result = $this->getResult();
		if (!isset($result->facet_counts)) {
			return;
		}

		if (isset($result->facet_counts->exception)) {
			// $this->logger->error($result->facet_counts->exception)
			return array();
		}
		
		$elems = $result->facet_counts->facet_fields;
		
		$facets = array();
		foreach ($elems as $field => $values) {
			$elemVals = array();
			foreach ($values as $vname => $vcount) {
				if ($vname == '_empty_') {
					continue;
				}
				$r = new stdClass;
				$r->Name = $vname;
				$r->Query = $vname;
				$r->Count = $vcount;
				$elemVals[] = $r;
			}
			$facets[$field] = $elemVals;
		}
		
		// see if there's any query facets for things too
		$query_elems = $result->facet_counts->facet_queries;
		if ($query_elems) {
			foreach ($query_elems as $vname => $count) {
				if ($vname == '_empty_') {
					continue;
				}
				
				list($field, $query) = explode(':', $vname);

				$r = new stdClass;
				$r->Type = 'query';
				$r->Name = $vname;
				$r->Query = $query;
				$r->Count = $count;
				
				$existing = isset($facets[$field]) ? $facets[$field] : array();
				$existing[] = $r;
				$facets[$field] = $existing;
			}
		}
		
		$this->returnedFacets = $facets;
		return $this->returnedFacets;
	}
public function getFacets ( ) { if ( $ this -> returnedFacets ) { return $ this -> returnedFacets ; } $ result = $ this -> getResult ( ) ; if ( ! isset ( $ result -> facet_counts ) ) { return ; } if ( isset ( $ result -> facet_counts -> exception ) ) { // $this->logger->error($result->facet_counts->exception) return array ( ) ; } $ elems = $ result -> facet_counts -> facet_fields ; $ facets = array ( ) ; foreach ( $ elems as $ field => $ values ) { $ elemVals = array ( ) ; foreach ( $ values as $ vname => $ vcount ) { if ( $ vname == '_empty_' ) { continue ; } $ r = new stdClass ; $ r -> Name = $ vname ; $ r -> Query = $ vname ; $ r -> Count = $ vcount ; $ elemVals [ ] = $ r ; } $ facets [ $ field ] = $ elemVals ; } // see if there's any query facets for things too $ query_elems = $ result -> facet_counts -> facet_queries ; if ( $ query_elems ) { foreach ( $ query_elems as $ vname => $ count ) { if ( $ vname == '_empty_' ) { continue ; } list ( $ field , $ query ) = explode ( ':' , $ vname ) ; $ r = new stdClass ; $ r -> Type = 'query' ; $ r -> Name = $ vname ; $ r -> Query = $ query ; $ r -> Count = $ count ; $ existing = isset ( $ facets [ $ field ] ) ? $ facets [ $ field ] : array ( ) ; $ existing [ ] = $ r ; $ facets [ $ field ] = $ existing ; } } $ this -> returnedFacets = $ facets ; return $ this -> returnedFacets ; }
Gets the details about facets found in this query

@return array
An array of facet values in the format
array(
'field_name' => stdClass {
name,
count
}
)
Gets the details about facets found in this query