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

array
$_facet= 'array()'
Holds all facet parameters.
Inherited from: \Elastica_Facet_Abstract::$$_facet\Elastica_Facet_Histogram::$$_facetarray()Details- Type
- array
- Inherited_from
- \Elastica_Facet_Abstract::$$_facet
- Inherited_from
- \Elastica_Facet_Histogram::$$_facet

string
$_name= ''''
Holds the name of the facet.
Inherited from: \Elastica_Facet_Abstract::$$_name\Elastica_Facet_Histogram::$$_name''Details- Type
- string
- Inherited_from
- \Elastica_Facet_Abstract::$$_name
- Inherited_from
- \Elastica_Facet_Histogram::$$_name

array
$_params= 'array()'
Params
Inherited from: \Elastica_Param::$$_params\Elastica_Facet_Abstract::$$_params\Elastica_Facet_Histogram::$$_paramsarray()Details- Type
- array
- Inherited_from
- \Elastica_Param::$$_params
- Inherited_from
- \Elastica_Facet_Abstract::$$_params
- Inherited_from
- \Elastica_Facet_Histogram::$$_params

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

__construct(
string $name
)
:
voidConstructs a Facet object.
Inherited from: \Elastica_Facet_Abstract::__construct()\Elastica_Facet_Histogram::__construct()| 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()\Elastica_Facet_Histogram::_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()\Elastica_Facet_Histogram::_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()\Elastica_Facet_Histogram::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 |

getName(
)
:
stringGets the name of the facet.
Inherited from: \Elastica_Facet_Abstract::getName()\Elastica_Facet_Histogram::getName()| Type | Description |
|---|---|
| string |

getParam(
string $key
)
:
mixedReturns a specific param
Inherited from: \Elastica_Param::getParam()\Elastica_Facet_Abstract::getParam()\Elastica_Facet_Histogram::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()\Elastica_Facet_Histogram::getParams()| Type | Description |
|---|---|
| array | Params |

setField(
string $field
)
:
\Elastica_Facet_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_AbstractSets a filter for this facet.
Inherited from: \Elastica_Facet_Abstract::setFilter()\Elastica_Facet_Histogram::setFilter()| 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()\Elastica_Facet_Histogram::setGlobal()| Name | Type | Description |
|---|---|---|
| $global | bool | Flag to either run the facet globally. |
| Type | Description |
|---|---|
| \Elastica_Facet_Abstract |

setInterval(
string $interval
)
:
\Elastica_Facet_Range
| 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
Inherited from: \Elastica_Facet_Histogram::setKeyValueFields()| 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.
Inherited from: \Elastica_Facet_Histogram::setKeyValueScripts()| 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()\Elastica_Facet_Histogram::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()\Elastica_Facet_Histogram::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()\Elastica_Facet_Histogram::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
Inherited from: \Elastica_Facet_Histogram::setScriptParams()| Name | Type | Description |
|---|---|---|
| $params | array | Associative array (key/value pair) |
| Type | Description |
|---|---|
| \Elastica_Facet_Histogram | Facet object |

setTimezone(
string $tzOffset
)
:
voidSet the time_zone parameter
| Name | Type | Description |
|---|---|---|
| $tzOffset | string |

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. |