PHP Class Elastica\Result

Stores all information from a result
Author: Nicolas Ruflin ([email protected])
Datei anzeigen Open project: ruflin/elastica Class Usage Examples

Protected Properties

Property Type Description
$_hit Hit array.

Public Methods

Method Description
__construct ( array $hit ) Constructs a single results object.
__get ( string $key ) : mixed Magic function to directly access keys inside the result.
__isset ( string $key ) : boolean Magic function to support isset() calls.
getData ( ) : array Returns result data.
getDocument ( ) : Document Returns Document.
getExplanation ( ) : array Returns explanation on how its score was computed.
getFields ( ) : array Returns list of fields.
getHighlights ( ) : array Returns result data.
getHit ( ) : array Returns the raw hit array.
getId ( ) : string Returns the hit id.
getIndex ( ) : string Returns the index name of the result.
getInnerHits ( ) : array Returns inner hits.
getParam ( string $name ) : mixed Returns a param from the result hit array.
getScore ( ) : float Returns the score of the result.
getSource ( ) : array Returns the result source.
getType ( ) : string Returns the type of the result.
getVersion ( ) : string | integer Returns the version information from the hit.
hasFields ( ) : boolean Returns whether result has fields.
hasInnerHits ( ) : boolean Returns whether result has inner hits.
hasParam ( string $name ) : boolean Test if a param from the result hit is set.
setParam ( string $param, mixed $value ) Sets a parameter on the hit.

Method Details

__construct() public method

Constructs a single results object.
public __construct ( array $hit )
$hit array Hit data

__get() public method

Returns null if key does not exist
public __get ( string $key ) : mixed
$key string Key name
return mixed Key value

__isset() public method

Magic function to support isset() calls.
public __isset ( string $key ) : boolean
$key string Key name
return boolean

getData() public method

Checks for partial result data with getFields, falls back to getSource or both
public getData ( ) : array
return array Result data array

getDocument() public method

Returns Document.
public getDocument ( ) : Document
return Document

getExplanation() public method

Returns explanation on how its score was computed.
public getExplanation ( ) : array
return array explanations

getFields() public method

Returns list of fields.
public getFields ( ) : array
return array Fields list

getHighlights() public method

Returns result data.
public getHighlights ( ) : array
return array Result data array

getHit() public method

Returns the raw hit array.
public getHit ( ) : array
return array Hit array

getId() public method

Returns the hit id.
public getId ( ) : string
return string Hit id

getIndex() public method

Returns the index name of the result.
public getIndex ( ) : string
return string Index name

getInnerHits() public method

Returns inner hits.
public getInnerHits ( ) : array
return array Fields list

getParam() public method

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
public getParam ( string $name ) : mixed
$name string Param name
return mixed Result data

getScore() public method

Returns the score of the result.
public getScore ( ) : float
return float Result score

getSource() public method

Returns the result source.
public getSource ( ) : array
return array Source data array

getType() public method

Returns the type of the result.
public getType ( ) : string
return string Result type

getVersion() public method

Returns the version information from the hit.
public getVersion ( ) : string | integer
return string | integer Document version

hasFields() public method

Returns whether result has fields.
public hasFields ( ) : boolean
return boolean

hasInnerHits() public method

Returns whether result has inner hits.
public hasInnerHits ( ) : boolean
return boolean

hasParam() public method

Test if a param from the result hit is set.
public hasParam ( string $name ) : boolean
$name string Param name to test
return boolean True if the param is set, false otherwise

setParam() public method

Sets a parameter on the hit.
public setParam ( string $param, mixed $value )
$param string
$value mixed

Property Details

$_hit protected_oe property

Hit array.
protected $_hit