include/SugarSearchEngine/Elastic/Elastica/Facet/Histogram.php
Implements the Histogram facet.
- Author
- Raul Martinez Jr
- Category
- Xodoa
- Link
- http://www.elasticsearch.org/guide/reference/api/search/facets/histogram-facet.html
- Package
- Elastica
\Elastica_Facet_Histogram
Implements the Histogram facet.
This function can be used to handle params for queries, filter, facets
- Parent(s)
- \Elastica_Facet_Abstract < \Elastica_Param
- Children
- \Elastica_Facet_DateHistogram
- Author
- Raul Martinez Jr
- Category
- Xodoa
- Link
- http://www.elasticsearch.org/guide/reference/api/search/facets/histogram-facet.html
Properties

array
$_facet= 'array()'
array()Details- Type
- array
- Inherited_from
- \Elastica_Facet_Abstract::$$_facet

string
$_name= ''''
''Details- Type
- string
- Inherited_from
- \Elastica_Facet_Abstract::$$_name

array
$_params= 'array()'
array()Details- Type
- array
- Inherited_from
- \Elastica_Param::$$_params
- Inherited_from
- \Elastica_Facet_Abstract::$$_params

$_rawParams= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \Elastica_Param::$$_rawParams
- Inherited_from
- \Elastica_Facet_Abstract::$$_rawParams
Methods

__construct(
string $name
)
:
void
| Name | Type | Description |
|---|---|---|
| $name | string | The name of the facet. |

_setFacetParam(
string $key, mixed $value
)
:
\Elastica_Facet_AbstractSets a param for the facet. Each facet implementation needs to take care of handling their own params.
Inherited from: \Elastica_Facet_Abstract::_setFacetParam()| Name | Type | Description |
|---|---|---|
| $key | string | The key of the param to set. |
| $value | mixed | The value of the param. |
| Type | Description |
|---|---|
| \Elastica_Facet_Abstract |

_setRawParam(
string $key, mixed $value
)
:
\Elastica_ParamSets params not inside params array
Inherited from: \Elastica_Param::_setRawParam()\Elastica_Facet_Abstract::_setRawParam()| Name | Type | Description |
|---|---|---|
| $key | string | |
| $value | mixed |
| Type | Description |
|---|---|
| \Elastica_Param |

addParam(
string $key, mixed $value
)
:
\Elastica_ParamAdds a param to the list
Inherited from: \Elastica_Param::addParam()\Elastica_Facet_Abstract::addParam()This function can be used to add an array of params
| Name | Type | Description |
|---|---|---|
| $key | string | Param key |
| $value | mixed | Value to set |
| Type | Description |
|---|---|
| \Elastica_Param |

getParam(
string $key
)
:
mixedReturns a specific param
Inherited from: \Elastica_Param::getParam()\Elastica_Facet_Abstract::getParam()| Name | Type | Description |
|---|---|---|
| $key | string | Key to return |
| Type | Description |
|---|---|
| mixed | Key value |
| Exception | Description |
|---|---|
| \Elastica_Exception_Invalid | If requested key is not set |

getParams(
)
:
arrayReturns the params array
Inherited from: \Elastica_Param::getParams()\Elastica_Facet_Abstract::getParams()| Type | Description |
|---|---|
| array | Params |

setField(
string $field
)
:
\Elastica_Facet_HistogramSets the field for histogram
| Name | Type | Description |
|---|---|---|
| $field | string | The name of the field for the historgram |
| Type | Description |
|---|---|
| \Elastica_Facet_Histogram |

setFilter(
\Elastica_Filter_Abstract $filter
)
:
\Elastica_Facet_Abstract
| Name | Type | Description |
|---|---|---|
| $filter | \Elastica_Filter_Abstract | A filter to apply on the facet. |
| Type | Description |
|---|---|
| \Elastica_Facet_Abstract |

setGlobal(
bool $global
=
true
)
:
\Elastica_Facet_AbstractSets the flag to either run the facet globally or bound to the current search query. When not set, it defaults to the ElasticSearch default value.
Inherited from: \Elastica_Facet_Abstract::setGlobal()| Name | Type | Description |
|---|---|---|
| $global | bool | Flag to either run the facet globally. |
| Type | Description |
|---|---|
| \Elastica_Facet_Abstract |

setInterval(
string $interval
)
:
\Elastica_Facet_RangeSet the value for interval
| Name | Type | Description |
|---|---|---|
| $interval | string |
| Type | Description |
|---|---|
| \Elastica_Facet_Range |

setKeyValueFields(
string $keyField, string $valueField
)
:
\Elastica_Facet_RangeSet the fields for key_field and value_field
| Name | Type | Description |
|---|---|---|
| $keyField | string | Key field |
| $valueField | string | Value field |
| Type | Description |
|---|---|
| \Elastica_Facet_Range |

setKeyValueScripts(
string $keyScript, string $valueScript
)
:
voidSets the key and value for this facet by script.
| Name | Type | Description |
|---|---|---|
| $keyScript | string | Script to check whether it falls into the range. |
| $valueScript | string | Script to use for statistical calculations. |

setName(
string $name
)
:
\Elastica_Facet_AbstractSets the name of the facet. It is automatically set by the constructor.
Inherited from: \Elastica_Facet_Abstract::setName()| Name | Type | Description |
|---|---|---|
| $name | string | The name of the facet. |
| Type | Description |
|---|---|
| \Elastica_Facet_Abstract |
| Exception | Description |
|---|---|
| \Elastica_Exception_Invalid |

setParam(
string $key, mixed $value
)
:
voidSets (overwrites) the value at the given key
Inherited from: \Elastica_Param::setParam()\Elastica_Facet_Abstract::setParam()| Name | Type | Description |
|---|---|---|
| $key | string | Key to set |
| $value | mixed | Key Value |

setParams(
array $params
)
:
\Elastica_ParamSets (overwrites) all params of this object
Inherited from: \Elastica_Param::setParams()\Elastica_Facet_Abstract::setParams()| Name | Type | Description |
|---|---|---|
| $params | array | Parameter list |
| Type | Description |
|---|---|
| \Elastica_Param |

setScriptParams(
array $params
)
:
\Elastica_Facet_HistogramSet the "params" essential to the a script
| Name | Type | Description |
|---|---|---|
| $params | array | Associative array (key/value pair) |
| Type | Description |
|---|---|
| \Elastica_Facet_Histogram | Facet object |

toArray(
)
:
arrayCreates the full facet definition, which includes the basic facet definition of the parent.
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Elastica_Exception_Invalid | When the right fields haven't been set. |