include/SugarSearchEngine/Elastic/Elastica/Facet/Terms.php
Implements the terms facet.
- Author
- Nicolas Ruflin
- Author
- Jasper van Wanrooy
- Category
- Xodoa
- Link
- http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet.html
- Package
- Elastica
\Elastica_Facet_Terms
Implements the terms facet.
This function can be used to handle params for queries, filter, facets
- Parent(s)
- \Elastica_Facet_Abstract < \Elastica_Param
- Author
- Nicolas Ruflin
- Author
- Jasper van Wanrooy
- Category
- Xodoa
- Link
- http://www.elasticsearch.org/guide/reference/api/search/facets/terms-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
$_orderTypes= 'array('count', 'term', 'reverse_count', 'reverse_term')'
Holds the types of ordering which are allowed by ElasticSearch.
array('count', 'term', 'reverse_count', 'reverse_term')Details- Type
- array

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 |

setAllTerms(
bool $allTerms
)
:
\Elastica_Facet_TermsSets the flag to return all available terms. When they don't have a hit, they have a count of zero.
| Name | Type | Description |
|---|---|---|
| $allTerms | bool | Flag to fetch all terms. |
| Type | Description |
|---|---|
| \Elastica_Facet_Terms |

setExclude(
array $exclude
)
:
\Elastica_Facet_TermsSet an array with terms which are omitted in the search.
| Name | Type | Description |
|---|---|---|
| $exclude | array | Numerical array which includes all terms which needs to be ignored. |
| Type | Description |
|---|---|
| \Elastica_Facet_Terms |

setField(
string $field
)
:
\Elastica_Facet_TermsSets the field for the terms.
| Name | Type | Description |
|---|---|---|
| $field | string | The field name for the terms. |
| Type | Description |
|---|---|
| \Elastica_Facet_Terms |

setFields(
array $fields
)
:
\Elastica_Facet_TermsSets multiple fields for the terms.
| Name | Type | Description |
|---|---|---|
| $fields | array | Numerical array with the fields for the terms. |
| Type | Description |
|---|---|
| \Elastica_Facet_Terms |

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 |

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 |

setOrder(
string $type
)
:
\Elastica_Facet_TermsSets the ordering type for this facet. ElasticSearch internal default is count.
| Name | Type | Description |
|---|---|---|
| $type | string | The order type to set use for sorting of the terms. |
| Type | Description |
|---|---|
| \Elastica_Facet_Terms |
| Exception | Description |
|---|---|
| \Elastica_Exception_Invalid | When an invalid order type was set. |

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 |

setSize(
int $size
)
:
\Elastica_Facet_TermsSets the amount of terms to be returned.
| Name | Type | Description |
|---|---|---|
| $size | int | The amount of terms to be returned. |
| Type | Description |
|---|---|
| \Elastica_Facet_Terms |