/** * Creates the full facet definition, which includes the basic * facet definition of the parent. * * @see Elastica_Facet_Abstract::toArray() * @throws Elastica_Exception_Invalid When the right fields haven't been set. * @return array */ public function toArray() { /** * Set the geo_distance in the abstract as param. */ $this->_setFacetParam ( 'geo_distance', $this->_params ); return parent::toArray (); }
/** * Creates the full facet definition, which includes the basic * facet definition of the parent. * * @see Elastica_Facet_Abstract::toArray() * @throws Elastica_Exception_Invalid When the right fields haven't been set. * @return array */ public function toArray() { /** * Set the range in the abstract as param. */ $this->_setFacetParam('histogram', $this->_params); return parent::toArray(); }
/** * Adds a Facet to the query * * @param Elastica_Facet_Abstract $facet Facet object * @return Elastica_Query Query object */ public function addFacet(Elastica_Facet_Abstract $facet) { $this->_params['facets'][$facet->getName()] = $facet->toArray(); return $this; }
/** * Creates the full facet definition, which includes the basic * facet definition of the parent. * * @see Elastica_Facet_Abstract::toArray() * @throws Elastica_Exception_Invalid When the right fields haven't been set. * @return array */ public function toArray() { /** * Check the facet for validity. * There are three ways to set the key and value field for the range: * - a single field for both key and value; or * - separate fields for key and value; or * - separate scripts for key and value. */ $fieldTypesSet = 0; if (isset($this->_params['field'])) { $fieldTypesSet++; } if (isset($this->_params['key_field'])) { $fieldTypesSet++; } if (isset($this->_params['key_script'])) { $fieldTypesSet++; } if ($fieldTypesSet === 0) { throw new Elastica_Exception_Invalid('Neither field, key_field nor key_script is set.'); } elseif ($fieldTypesSet > 1) { throw new Elastica_Exception_Invalid('Either field, key_field and key_value or key_script and value_script should be set.'); } /** * Set the range in the abstract as param. */ $this->_setFacetParam('range', $this->_params); return parent::toArray(); }
/** * Creates the full facet definition, which includes the basic * facet definition of the parent. * * @see Elastica_Facet_Abstract::toArray() * @return array */ public function toArray() { $this->_setFacetParam('statistical', $this->_params); return parent::toArray(); }
/** * Creates the full facet definition, which includes the basic * facet definition of the parent. * * @see Elastica_Facet_Abstract::toArray() * @return array */ public function toArray() { $this->_setFacetParam('terms', $this->_params); return parent::toArray(); }