PHP Class ElasticSearcher\Abstracts\AbstractQuery

Inheritance: use trait ElasticSearcher\Traits\BodyTrait
Show file Open project: madewithlove/elasticsearcher Class Usage Examples

Protected Properties

Property Type Description
$data array Data that can be used when building a query.
$fragmentParser ElasticSearcher\Parsers\FragmentParser
$indices array Indices on which the query should be executed.
$queryStringParams array Parameters to be added to the search URL.
$resultParser ElasticSearcher\Abstracts\AbstractResultParser
$searcher ElasticSearcher\ElasticSearcher
$types array Types on which the query should be executed.

Public Methods

Method Description
__construct ( ElasticSearcher $searcher )
addData ( array $data ) Add data that can be accessed during query building.
getData ( $key = null ) : mixed
getIndices ( ) : array Indices we are searching in.
getRawQuery ( ) : array Get the query after being build.
getResultParser ( ) : mixed
getTypes ( ) : array Types we are searching in.
parseResultsWith ( ElasticSearcher\Abstracts\AbstractResultParser $resultParser )
run ( ) : ElasticSearcher\Abstracts\AbstractResultParser Build and execute the query.
searchIn ( string | array $index, null | string | array $type = null ) Define on which indices and types the query should be run.

Protected Methods

Method Description
buildQuery ( ) : array Build the query by adding all chunks together.
getQueryStringParam ( string $name ) : mixed
getSearchType ( ) : string
removeQueryStringParam ( string $name )
searchInIndices ( array $indices )
searchInTypes ( array $types )
setQueryStringParam ( string $name, mixed $value )
setSearchType ( string $type )
setup ( ) Prepare the query. Add filters, sorting, .

Method Details

__construct() public method

public __construct ( ElasticSearcher $searcher )
$searcher ElasticSearcher\ElasticSearcher

addData() public method

Add data that can be accessed during query building.
public addData ( array $data )
$data array

buildQuery() protected method

Build the query by adding all chunks together.
protected buildQuery ( ) : array
return array

getData() public method

public getData ( $key = null ) : mixed
return mixed

getIndices() public method

Indices we are searching in.
public getIndices ( ) : array
return array

getQueryStringParam() protected method

protected getQueryStringParam ( string $name ) : mixed
$name string
return mixed

getRawQuery() public method

This is what will be sent to the elasticsearch SDK.
public getRawQuery ( ) : array
return array

getResultParser() public method

public getResultParser ( ) : mixed
return mixed

getSearchType() protected method

protected getSearchType ( ) : string
return string

getTypes() public method

Types we are searching in.
public getTypes ( ) : array
return array

parseResultsWith() public method

public parseResultsWith ( ElasticSearcher\Abstracts\AbstractResultParser $resultParser )
$resultParser ElasticSearcher\Abstracts\AbstractResultParser

removeQueryStringParam() protected method

protected removeQueryStringParam ( string $name )
$name string

run() public method

Build and execute the query.
public run ( ) : ElasticSearcher\Abstracts\AbstractResultParser
return ElasticSearcher\Abstracts\AbstractResultParser

searchIn() public method

Define on which indices and types the query should be run.
public searchIn ( string | array $index, null | string | array $type = null )
$index string | array
$type null | string | array

searchInIndices() protected method

protected searchInIndices ( array $indices )
$indices array

searchInTypes() protected method

protected searchInTypes ( array $types )
$types array

setQueryStringParam() protected method

protected setQueryStringParam ( string $name, mixed $value )
$name string
$value mixed

setSearchType() protected method

See also: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-search-type.html
protected setSearchType ( string $type )
$type string

setup() abstract protected method

...
abstract protected setup ( )

Property Details

$data protected property

Data that can be used when building a query.
protected array $data
return array

$fragmentParser protected property

protected FragmentParser,ElasticSearcher\Parsers $fragmentParser
return ElasticSearcher\Parsers\FragmentParser

$indices protected property

Indices on which the query should be executed.
protected array $indices
return array

$queryStringParams protected property

Parameters to be added to the search URL.
protected array $queryStringParams
return array

$resultParser protected property

protected AbstractResultParser,ElasticSearcher\Abstracts $resultParser
return ElasticSearcher\Abstracts\AbstractResultParser

$searcher protected property

protected ElasticSearcher,ElasticSearcher $searcher
return ElasticSearcher\ElasticSearcher

$types protected property

Types on which the query should be executed.
protected array $types
return array