include/SugarSearchEngine/Elastic/Elastica/Query.php

Show: inherited
Table of Contents

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

Package: Elastica

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

Propertyprotectedarray  $_params= 'array()'

Params

Default valuearray()Details
Type
array
Propertyprotected  $_rawParams= 'array()'
inheritedInherited from: \Elastica_Param::$$_rawParams
Default valuearray()Details
Type
n/a
Inherited_from
\Elastica_Param::$$_rawParams  

Methods

methodpublic__construct( array | \Elastica_Query_Abstract $query = null ) : void

Creates a query object

Parameters
Name Type Description
$query array | \Elastica_Query_Abstract

OPTIONAL Query object (default = null)

methodprotected_setRawParam( string $key, mixed $value ) : \Elastica_Param
inherited

Sets params not inside params array

Inherited from: \Elastica_Param::_setRawParam()
Parameters
Name Type Description
$key string
$value mixed
Returns
Type Description
\Elastica_Param
methodpublicaddFacet( \Elastica_Facet_Abstract $facet ) : \Elastica_Query

Adds a Facet to the query

Parameters
Name Type Description
$facet \Elastica_Facet_Abstract

Facet object

Returns
Type Description
\Elastica_Query Query object
methodpublicaddHighlight( mixed $highlight ) : \Elastica_Query

Adds a highlight argument

Parameters
Name Type Description
$highlight mixed

Add highlight argument

Returns
Type Description
\Elastica_Query Query object
Details
Link
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/highlighting/  
methodpublicaddParam( string $key, mixed $value ) : \Elastica_Param
inherited

Adds a param to the list

Inherited from: \Elastica_Param::addParam()

This function can be used to add an array of params

Parameters
Name Type Description
$key string

Param key

$value mixed

Value to set

Returns
Type Description
\Elastica_Param
methodpublicaddSort( mixed $sort ) : \Elastica_Query

Adds a sort param to the query

Parameters
Name Type Description
$sort mixed

Sort parameter

Returns
Type Description
\Elastica_Query Query object
Details
Link
http://www.elasticsearch.org/guide/reference/api/search/sort.html  
methodpubliccreate( mixed $query ) : \Elastica_Query
static

Transforms a string or an array to a query object

If query is empty,

Parameters
Name Type Description
$query mixed
Returns
Type Description
\Elastica_Query
methodpublicgetParam( string $key ) : mixed
inherited

Returns a specific param

Inherited from: \Elastica_Param::getParam()
Parameters
Name Type Description
$key string

Key to return

Returns
Type Description
mixed Key value
Throws
Exception Description
\Elastica_Exception_Invalid If requested key is not set
methodpublicgetParams( ) : array
inherited

Returns the params array

Inherited from: \Elastica_Param::getParams()
Returns
Type Description
array Params
methodpublicgetQuery( ) : array

Gets the query array

Returns
Type Description
array
methodpublicsetExplain( bool $explain = true ) : \Elastica_Query

Enables explain on the query

Parameters
Name Type Description
$explain bool

OPTIONAL Enabled or disable explain (default = true)

Returns
Type Description
\Elastica_Query Current object
Details
Link
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/explain/  
methodpublicsetFacets( array $facets ) : \Elastica_Query

Sets all facets for this query object. Replaces existing facets

Parameters
Name Type Description
$facets array

List of facet objects

Returns
Type Description
\Elastica_Query Query object
Details
Link
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/facets  
methodpublicsetFields( array $fields ) : \Elastica_Query

Sets the fields to be returned by the search

Parameters
Name Type Description
$fields array

Fields to be returne

Returns
Type Description
\Elastica_Query Current object
Details
Link
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/fields/  
methodpublicsetFilter( \Elastica_Filter_Abstract $filter ) : \Elastica_Query

Parameters
Name Type Description
$filter \Elastica_Filter_Abstract

Filter object

Returns
Type Description
\Elastica_Query Current object
methodpublicsetFrom( int $from ) : \Elastica_Query

Sets the start from which the search results should be returned

Parameters
Name Type Description
$from int
Returns
Type Description
\Elastica_Query Query object
methodpublicsetHighlight( array $highlightArgs ) : \Elastica_Query

Sets highlight arguments for the query

Parameters
Name Type Description
$highlightArgs array

Set all highlight arguments

Returns
Type Description
\Elastica_Query Query object
Details
Link
http://www.elasticsearch.org/guide/reference/api/search/highlighting.html  
methodpublicsetLimit( int $limit = 10 ) : \Elastica_Query

Sets maximum number of results for this query

Setting the limit to 0, means no limit

Parameters
Name Type Description
$limit int

OPTIONAL Maximal number of results for query (default = 10)

Returns
Type Description
\Elastica_Query Query object
methodpublicsetMinScore( int | double $minScore ) : \Elastica_Query

Allows filtering of documents based on a minimum score

Parameters
Name Type Description
$minScore int | double

Minimum score to filter documents by

Returns
Type Description
\Elastica_Query Query object
methodpublicsetParam( string $key, mixed $value ) : void
inherited

Sets (overwrites) the value at the given key

Inherited from: \Elastica_Param::setParam()
Parameters
Name Type Description
$key string

Key to set

$value mixed

Key Value

methodpublicsetParams( array $params ) : \Elastica_Param
inherited

Sets (overwrites) all params of this object

Inherited from: \Elastica_Param::setParams()
Parameters
Name Type Description
$params array

Parameter list

Returns
Type Description
\Elastica_Param
methodpublicsetQuery( \Elastica_Query_Abstract $query ) : \Elastica_Query

Sets the query

Parameters
Name Type Description
$query \Elastica_Query_Abstract

Query object

Returns
Type Description
\Elastica_Query Query object
methodpublicsetRawQuery( array $query ) : \Elastica_Query

Sets query as raw array. Will overwrite all already set arguments

Parameters
Name Type Description
$query array

Query array

Returns
Type Description
\Elastica_Query Query object
methodpublicsetScriptFields( array $scriptFields ) : \Elastica_Query

Set script fields

Parameters
Name Type Description
$scriptFields array

Script fields

Returns
Type Description
\Elastica_Query Current object
Details
Link
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/script_fields/  
methodpublicsetSize( int $limit = 10 ) : \Elastica_Query

Alias for setLimit

Parameters
Name Type Description
$limit int

OPTIONAL Maximal number of results for query (default = 10)

Returns
Type Description
\Elastica_Query Query object
methodpublicsetSort( array $sortArgs ) : \Elastica_Query

Sets sort arguments for the query Replaces existing values

Parameters
Name Type Description
$sortArgs array

Sorting arguments

Returns
Type Description
\Elastica_Query Query object
Details
Link
http://www.elasticsearch.org/guide/reference/api/search/sort.html  
methodpublicsetVersion( bool $version = true ) : \Elastica_Query

Enables version on the query

Parameters
Name Type Description
$version bool

OPTIONAL Enabled or disable version (default = true)

Returns
Type Description
\Elastica_Query Current object
Details
Link
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/version/  
methodpublictoArray( ) : array

Converts all query params to an array

Returns
Type Description
array Query array
Documentation was generated by DocBlox 0.18.1.