SuggestParamsBuilder class

更新时间:
复制 MD 格式

Builds the parameter object for drop-down suggestion queries in the OpenSearch PHP SDK. Pass the built object to the execute method of a SuggestClient instance to run the query.

Methods

__construct()

Creates a SuggestParamsBuilder instance.

Method signature

mixed OpenSearch\Util\SuggestParamsBuilder::__construct()

build()

Builds a drop-down suggestion parameter object to pass to SuggestClient::execute().

Method signature

mixed OpenSearch\Util\SuggestParamsBuilder::build($appName, $suggestName, $query, $hits)

Parameters

ParameterTypeDescription
$appNamemixedThe OpenSearch application name.
$suggestNamemixedThe name of the drop-down suggestion configured in the application.
$querymixedThe keyword to retrieve suggestions for.
$hitsmixedThe number of suggestions to return.

getQueryParams()

Returns the query parameters from a SearchParams object built by build().

Method signature

mixed OpenSearch\Util\SuggestParamsBuilder::getQueryParams($searchParams)

Parameters

ParameterTypeDescription
$searchParamsmixedThe SearchParams object returned by the build() method of this class.