PHP Class Elastica\ResultSet

List of all hits that are returned for a search on elasticsearch Result set implements iterator
Author: Nicolas Ruflin ([email protected])
Inheritance: implements Iterator, implements Countable, implements ArrayAccess
Show file Open project: ruflin/elastica Class Usage Examples

Public Methods

Method Description
__construct ( Response $response, Query $query, Result[] $results ) Constructs ResultSet object.
count ( ) : integer Returns size of current set.
countSuggests ( ) : integer Returns size of current suggests.
current ( ) : Result | boolean Returns the current object of the set.
getAggregation ( string $name ) : array Retrieve a specific aggregation from this result set.
getAggregations ( ) : array Returns all aggregation results.
getDocuments ( ) : array Returns all Documents.
getMaxScore ( ) : float Returns the max score of the results found.
getQuery ( ) : Query
getResponse ( ) : Response Returns response object.
getResults ( ) : Result[] Returns all results.
getSuggests ( ) : array Return all suggests.
getTotalHits ( ) : integer Returns the total number of found hits.
getTotalTime ( ) : integer Returns the total number of ms for this search to complete.
hasAggregations ( ) : boolean Returns whether aggregations exist.
hasSuggests ( ) : boolean Returns true if the response contains suggestion results; false otherwise.
hasTimedOut ( ) : boolean Returns true if the query has timed out.
key ( ) : integer Returns the position of the current entry.
next ( ) Sets pointer (current) to the next item of the set.
offsetExists ( integer $offset ) : boolean Whether a offset exists.
offsetGet ( integer $offset ) : Result | null Offset to retrieve.
offsetSet ( integer $offset, Result $value ) Offset to set.
offsetUnset ( integer $offset ) Offset to unset.
rewind ( ) Resets position to 0, restarts iterator.
valid ( ) : boolean Check if an object exists at the current position.

Method Details

__construct() public method

Constructs ResultSet object.
public __construct ( Response $response, Query $query, Result[] $results )
$response Response Response object
$query Query Query object
$results Result[]

count() public method

Returns size of current set.
public count ( ) : integer
return integer Size of set

countSuggests() public method

Returns size of current suggests.
public countSuggests ( ) : integer
return integer Size of suggests

current() public method

Returns the current object of the set.
public current ( ) : Result | boolean
return Result | boolean Set object or false if not valid (no more entries)

getAggregation() public method

Retrieve a specific aggregation from this result set.
public getAggregation ( string $name ) : array
$name string the name of the desired aggregation
return array

getAggregations() public method

Returns all aggregation results.
public getAggregations ( ) : array
return array

getDocuments() public method

Returns all Documents.
public getDocuments ( ) : array
return array Documents \Elastica\Document

getMaxScore() public method

Returns the max score of the results found.
public getMaxScore ( ) : float
return float Max Score

getQuery() public method

public getQuery ( ) : Query
return Query

getResponse() public method

Returns response object.
public getResponse ( ) : Response
return Response Response object

getResults() public method

Returns all results.
public getResults ( ) : Result[]
return Result[] Results

getSuggests() public method

Return all suggests.
public getSuggests ( ) : array
return array suggest results

getTotalHits() public method

Returns the total number of found hits.
public getTotalHits ( ) : integer
return integer Total hits

getTotalTime() public method

Returns the total number of ms for this search to complete.
public getTotalTime ( ) : integer
return integer Total time

hasAggregations() public method

Returns whether aggregations exist.
public hasAggregations ( ) : boolean
return boolean Aggregation existence

hasSuggests() public method

Returns true if the response contains suggestion results; false otherwise.
public hasSuggests ( ) : boolean
return boolean

hasTimedOut() public method

Returns true if the query has timed out.
public hasTimedOut ( ) : boolean
return boolean Timed out

key() public method

Returns the position of the current entry.
public key ( ) : integer
return integer Current position

next() public method

Sets pointer (current) to the next item of the set.
public next ( )

offsetExists() public method

Whether a offset exists.
public offsetExists ( integer $offset ) : boolean
$offset integer
return boolean true on success or false on failure.

offsetGet() public method

Offset to retrieve.
public offsetGet ( integer $offset ) : Result | null
$offset integer
return Result | null

offsetSet() public method

Offset to set.
public offsetSet ( integer $offset, Result $value )
$offset integer
$value Result

offsetUnset() public method

Offset to unset.
public offsetUnset ( integer $offset )
$offset integer

rewind() public method

Resets position to 0, restarts iterator.
public rewind ( )

valid() public method

Check if an object exists at the current position.
public valid ( ) : boolean
return boolean True if object exists