include/SugarSearchEngine/Elastic/Elastica/Query.php
Elastica query object
Creates different types of queries
- Author
- Nicolas Ruflin
- Category
- Xodoa
- Link
- http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/
- Package
- Elastica
\Elastica_Query
Elastica query object
Creates different types of queries
- Parent(s)
- \Elastica_Param
- Author
- Nicolas Ruflin
- Category
- Xodoa
- Link
- http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/
Properties

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

__construct(
array | \Elastica_Query_Abstract $query
=
null
)
:
voidCreates a query object
| Name | Type | Description |
|---|---|---|
| $query | array | \Elastica_Query_Abstract | OPTIONAL Query object (default = null) |

_setRawParam(
string $key, mixed $value
)
:
\Elastica_Param
| Name | Type | Description |
|---|---|---|
| $key | string | |
| $value | mixed |
| Type | Description |
|---|---|
| \Elastica_Param |

addFacet(
\Elastica_Facet_Abstract $facet
)
:
\Elastica_QueryAdds a Facet to the query
| Name | Type | Description |
|---|---|---|
| $facet | \Elastica_Facet_Abstract | Facet object |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

addHighlight(
mixed $highlight
)
:
\Elastica_QueryAdds a highlight argument
| Name | Type | Description |
|---|---|---|
| $highlight | mixed | Add highlight argument |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

addParam(
string $key, mixed $value
)
:
\Elastica_Param
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 |

addSort(
mixed $sort
)
:
\Elastica_QueryAdds a sort param to the query
| Name | Type | Description |
|---|---|---|
| $sort | mixed | Sort parameter |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

create(
mixed $query
)
:
\Elastica_QueryTransforms a string or an array to a query object
If query is empty,
| Name | Type | Description |
|---|---|---|
| $query | mixed |
| Type | Description |
|---|---|
| \Elastica_Query |

getParam(
string $key
)
:
mixed
| Name | Type | Description |
|---|---|---|
| $key | string | Key to return |
| Type | Description |
|---|---|
| mixed | Key value |
| Exception | Description |
|---|---|
| \Elastica_Exception_Invalid | If requested key is not set |

setExplain(
bool $explain
=
true
)
:
\Elastica_QueryEnables explain on the query
| Name | Type | Description |
|---|---|---|
| $explain | bool | OPTIONAL Enabled or disable explain (default = true) |
| Type | Description |
|---|---|
| \Elastica_Query | Current object |

setFacets(
array $facets
)
:
\Elastica_QuerySets all facets for this query object. Replaces existing facets
| Name | Type | Description |
|---|---|---|
| $facets | array | List of facet objects |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

setFields(
array $fields
)
:
\Elastica_QuerySets the fields to be returned by the search
| Name | Type | Description |
|---|---|---|
| $fields | array | Fields to be returne |
| Type | Description |
|---|---|
| \Elastica_Query | Current object |

setFilter(
\Elastica_Filter_Abstract $filter
)
:
\Elastica_Query| Name | Type | Description |
|---|---|---|
| $filter | \Elastica_Filter_Abstract | Filter object |
| Type | Description |
|---|---|
| \Elastica_Query | Current object |

setFrom(
int $from
)
:
\Elastica_QuerySets the start from which the search results should be returned
| Name | Type | Description |
|---|---|---|
| $from | int |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

setHighlight(
array $highlightArgs
)
:
\Elastica_QuerySets highlight arguments for the query
| Name | Type | Description |
|---|---|---|
| $highlightArgs | array | Set all highlight arguments |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

setLimit(
int $limit
=
10
)
:
\Elastica_QuerySets maximum number of results for this query
Setting the limit to 0, means no limit
| Name | Type | Description |
|---|---|---|
| $limit | int | OPTIONAL Maximal number of results for query (default = 10) |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

setMinScore(
int | double $minScore
)
:
\Elastica_QueryAllows filtering of documents based on a minimum score
| Name | Type | Description |
|---|---|---|
| $minScore | int | double | Minimum score to filter documents by |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

setParam(
string $key, mixed $value
)
:
void
| Name | Type | Description |
|---|---|---|
| $key | string | Key to set |
| $value | mixed | Key Value |

setParams(
array $params
)
:
\Elastica_Param
| Name | Type | Description |
|---|---|---|
| $params | array | Parameter list |
| Type | Description |
|---|---|
| \Elastica_Param |

setQuery(
\Elastica_Query_Abstract $query
)
:
\Elastica_QuerySets the query
| Name | Type | Description |
|---|---|---|
| $query | \Elastica_Query_Abstract | Query object |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

setRawQuery(
array $query
)
:
\Elastica_QuerySets query as raw array. Will overwrite all already set arguments
| Name | Type | Description |
|---|---|---|
| $query | array | Query array |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

setScriptFields(
array $scriptFields
)
:
\Elastica_QuerySet script fields
| Name | Type | Description |
|---|---|---|
| $scriptFields | array | Script fields |
| Type | Description |
|---|---|
| \Elastica_Query | Current object |

setSize(
int $limit
=
10
)
:
\Elastica_QueryAlias for setLimit
| Name | Type | Description |
|---|---|---|
| $limit | int | OPTIONAL Maximal number of results for query (default = 10) |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

setSort(
array $sortArgs
)
:
\Elastica_QuerySets sort arguments for the query Replaces existing values
| Name | Type | Description |
|---|---|---|
| $sortArgs | array | Sorting arguments |
| Type | Description |
|---|---|
| \Elastica_Query | Query object |

setVersion(
bool $version
=
true
)
:
\Elastica_QueryEnables version on the query
| Name | Type | Description |
|---|---|---|
| $version | bool | OPTIONAL Enabled or disable version (default = true) |
| Type | Description |
|---|---|
| \Elastica_Query | Current object |