PHP Class Elastica\Search

Author: Nicolas Ruflin ([email protected])
Datei anzeigen Open project: ruflin/elastica Class Usage Examples

Protected Properties

Property Type Description
$_client Client Client object.
$_indices array Array of indices.
$_options array
$_query Query
$_types array Array of types.

Public Methods

Method Description
__construct ( Client $client, Elastica\ResultSet\BuilderInterface $builder = null ) Constructs search object.
addIndex ( Index | string $index ) Adds a index to the list.
addIndices ( array $indices = [] ) Add array of indices at once.
addOption ( string $key, mixed $value )
addType ( Type | string $type ) Adds a type to the current search.
addTypes ( array $types = [] ) Add array of types.
clearOptions ( )
count ( mixed $query = '', $fullResult = false ) : integer | ResultSet
create ( elastica\SearchableInterface $searchObject ) : Search Creates new search object.
getClient ( ) : Client Return client object.
getIndices ( ) : array Return array of indices.
getOption ( string $key ) : mixed
getOptions ( ) : array
getPath ( ) : string Combines indices and types to the search request path.
getQuery ( ) : Query
getResultSetBuilder ( ) : Elastica\ResultSet\BuilderInterface
getTypes ( ) : array Return array of types.
hasIndex ( Index | string $index ) : boolean
hasIndices ( ) : boolean
hasOption ( string $key ) : boolean
hasType ( Type | string $type ) : boolean
hasTypes ( ) : boolean
scroll ( string $expiryTime = '1m' ) : Scroll Returns the Scroll Iterator.
search ( mixed $query = '', integer | array $options = null ) : ResultSet Search in the set indices, types.
setOption ( string $key, mixed $value )
setOptions ( array $options )
setOptionsAndQuery ( array | integer $options = null, string | array | Query $query = '' )
setQuery ( string | array | Query | Elastica\Suggest | Elastica\Query\AbstractQuery $query )
setSuggest ( elastica\Suggest $suggest )

Protected Methods

Method Description
_validateOption ( string $key ) : boolean

Method Details

__construct() public method

Constructs search object.
public __construct ( Client $client, Elastica\ResultSet\BuilderInterface $builder = null )
$client Client Client object
$builder Elastica\ResultSet\BuilderInterface

_validateOption() protected method

protected _validateOption ( string $key ) : boolean
$key string
return boolean

addIndex() public method

Adds a index to the list.
public addIndex ( Index | string $index )
$index Index | string Index object or string

addIndices() public method

Add array of indices at once.
public addIndices ( array $indices = [] )
$indices array

addOption() public method

public addOption ( string $key, mixed $value )
$key string
$value mixed

addType() public method

Adds a type to the current search.
public addType ( Type | string $type )
$type Type | string Type name or object

addTypes() public method

Add array of types.
public addTypes ( array $types = [] )
$types array

clearOptions() public method

public clearOptions ( )

count() public method

public count ( mixed $query = '', $fullResult = false ) : integer | ResultSet
$query mixed
$fullResult (default = false) By default only the total hit count is returned. If set to true, the full ResultSet including aggregations is returned
return integer | ResultSet

create() public static method

Creates new search object.
public static create ( elastica\SearchableInterface $searchObject ) : Search
$searchObject elastica\SearchableInterface
return Search

getClient() public method

Return client object.
public getClient ( ) : Client
return Client Client object

getIndices() public method

Return array of indices.
public getIndices ( ) : array
return array List of index names

getOption() public method

public getOption ( string $key ) : mixed
$key string
return mixed

getOptions() public method

public getOptions ( ) : array
return array

getPath() public method

Combines indices and types to the search request path.
public getPath ( ) : string
return string Search path

getQuery() public method

public getQuery ( ) : Query
return Query

getResultSetBuilder() public method

public getResultSetBuilder ( ) : Elastica\ResultSet\BuilderInterface
return Elastica\ResultSet\BuilderInterface

getTypes() public method

Return array of types.
public getTypes ( ) : array
return array List of types

hasIndex() public method

public hasIndex ( Index | string $index ) : boolean
$index Index | string
return boolean

hasIndices() public method

public hasIndices ( ) : boolean
return boolean

hasOption() public method

public hasOption ( string $key ) : boolean
$key string
return boolean

hasType() public method

public hasType ( Type | string $type ) : boolean
$type Type | string
return boolean

hasTypes() public method

public hasTypes ( ) : boolean
return boolean

scroll() public method

Returns the Scroll Iterator.
See also: Elastica\Scroll
public scroll ( string $expiryTime = '1m' ) : Scroll
$expiryTime string
return Scroll

setOption() public method

public setOption ( string $key, mixed $value )
$key string
$value mixed

setOptions() public method

public setOptions ( array $options )
$options array

setOptionsAndQuery() public method

public setOptionsAndQuery ( array | integer $options = null, string | array | Query $query = '' )
$options array | integer
$query string | array | Query

setQuery() public method

public setQuery ( string | array | Query | Elastica\Suggest | Elastica\Query\AbstractQuery $query )
$query string | array | Query | Elastica\Suggest | Elastica\Query\AbstractQuery

setSuggest() public method

public setSuggest ( elastica\Suggest $suggest )
$suggest elastica\Suggest

Property Details

$_client protected_oe property

Client object.
protected Client,Elastica $_client
return Client

$_indices protected_oe property

Array of indices.
protected array $_indices
return array

$_options protected_oe property

protected array $_options
return array

$_query protected_oe property

protected Query,Elastica $_query
return Query

$_types protected_oe property

Array of types.
protected array $_types
return array