\ElasticaResult

Elastica result item.

Stores all information from a result

Summary

Methods
Properties
Constants
__construct()
getParam()
hasParam()
getId()
getType()
getFields()
hasFields()
getIndex()
getScore()
getHit()
getVersion()
getInnerHits()
hasInnerHits()
getData()
getSource()
getHighlights()
getExplanation()
getDocument()
setParam()
__get()
__isset()
No public properties found
No constants found
No protected methods found
$_hit
N/A
No private methods found
No private properties found
N/A

Properties

$_hit

$_hit : array

Hit array.

Type

array — Hit array

Methods

__construct()

__construct(array  $hit) 

Constructs a single results object.

Parameters

array $hit

Hit data

getParam()

getParam(string  $name) : mixed

Returns a param from the result hit array.

This function can be used to retrieve all data for which a specific function doesn't exist. If the param does not exist, an empty array is returned

Parameters

string $name

Param name

Returns

mixed —

Result data

hasParam()

hasParam(string  $name) : boolean

Test if a param from the result hit is set.

Parameters

string $name

Param name to test

Returns

boolean —

True if the param is set, false otherwise

getId()

getId() : string

Returns the hit id.

Returns

string —

Hit id

getType()

getType() : string

Returns the type of the result.

Returns

string —

Result type

getFields()

getFields() : array

Returns list of fields.

Returns

array —

Fields list

hasFields()

hasFields() : boolean

Returns whether result has fields.

Returns

boolean

getIndex()

getIndex() : string

Returns the index name of the result.

Returns

string —

Index name

getScore()

getScore() : float

Returns the score of the result.

Returns

float —

Result score

getHit()

getHit() : array

Returns the raw hit array.

Returns

array —

Hit array

getVersion()

getVersion() : string|integer

Returns the version information from the hit.

Returns

string|integer —

Document version

getInnerHits()

getInnerHits() : array

Returns inner hits.

Returns

array —

Fields list

hasInnerHits()

hasInnerHits() : boolean

Returns whether result has inner hits.

Returns

boolean

getData()

getData() : array

Returns result data.

Checks for partial result data with getFields, falls back to getSource or both

Returns

array —

Result data array

getSource()

getSource() : array

Returns the result source.

Returns

array —

Source data array

getHighlights()

getHighlights() : array

Returns result data.

Returns

array —

Result data array

getExplanation()

getExplanation() : array

Returns explanation on how its score was computed.

Returns

array —

explanations

getDocument()

getDocument() : \Elastica\Document

Returns Document.

Returns

\Elastica\Document

setParam()

setParam(string  $param, mixed  $value) 

Sets a parameter on the hit.

Parameters

string $param
mixed $value

__get()

__get(string  $key) : mixed

Magic function to directly access keys inside the result.

Returns null if key does not exist

Parameters

string $key

Key name

Returns

mixed —

Key value

__isset()

__isset(string  $key) : boolean

Magic function to support isset() calls.

Parameters

string $key

Key name

Returns

boolean