Overview
The SearchParamsBuilder class is used to construct a parameter object for a SearchParams object.
Constructor
Method definition
mixed OpenSearch\Util\SearchParamsBuilder::__construct($opts)
Parameter description
Parameter | Type | Description |
$opts | mixed | The query parameters. |
setStart
Specifies the ordinal number of the first document to be returned in search results.
Method definition
void OpenSearch\Util\SearchParamsBuilder::setStart(integer $start)
Parameter description
Parameter | Type | Description |
$start | integer | The ordinal number of the first document to be returned in search results. |
setHits
Method definition
void OpenSearch\Util\SearchParamsBuilder::setHits( $hits)
Parameter description
Parameter | Type | Description |
$hits | integer | The maximum number of documents in each result set. |
setFormat
Specifies the data format of return results. Supported formats are XML, JSON, and FULLJSON. Compared with the JSON format, the FULLJSON format supports extra fields such as variableValue.
Method definition
void OpenSearch\Util\SearchParamsBuilder::setFormat(String $format)
Parameter description
Parameter | Type | Description |
$format | String | The data format of return results. |
setAppName
Method definition
void OpenSearch\Util\SearchParamsBuilder::setAppName($appNames)
Parameter description
Parameter | Type | Description |
$appNames | mixed | The name of the application for which you want to implement the search feature. |
setQuery
Method definition
void OpenSearch\Util\SearchParamsBuilder::setQuery( $query)
Parameter description
Parameter | Type | Description |
$query | String | The query keyword in the following format: Index field name:'Keyword' [ AND or OR … ]. |
setKvPairs
Method definition
void OpenSearch\Util\SearchParamsBuilder::setKvPairs( $kvPairs)
Parameter description
Parameter | Type | Description |
$kvPairs | String | The key-value pairs that you want to set. |
setFetchFields
Method definition
void OpenSearch\Util\SearchParamsBuilder::setFetchFields(array $fetchFields)
Parameter description
Parameter | Type | Description |
$fetchFields | array | The fields to be returned in results. Example: array('a', 'b'). |
setRouteValue
Method definition
void OpenSearch\Util\SearchParamsBuilder::setRouteValue( $routeValue)
Parameter description
Parameter | Type | Description |
$routeValue | Mixed | The field values that are used for grouping. |
setCustomConfig
Method definition
void OpenSearch\Util\SearchParamsBuilder::setCustomConfig(String $key, Mixed $value)
Parameter description
Parameter | Type | Description |
$key | String | The key of the custom parameter. |
$value | Mixed | The value of the custom parameter. |
addFilter
Method definition
void OpenSearch\Util\SearchParamsBuilder::addFilter( $filter, $condition)
Parameter description
Parameter | Type | Description |
$filter | String | The filter condition. Example: a > 1. |
$condition | String | The logical operator to connect the two filter conditions, such as AND and OR. |
setFilter
Method definition
void OpenSearch\Util\SearchParamsBuilder::setFilter($filterString)
Parameter description
Parameter | Type | Description |
$filterString | mixed | The filter condition. |
addSort
Method definition
void OpenSearch\Util\SearchParamsBuilder::addSort( $field, $order)
Parameter description
Parameter | Type | Description |
$field | String | The field based on which documents are to be sorted. |
$order | mixed | The sorting method. Valid values: SearchParamsBuilder::SORT_INCREASE and SearchParamsBuilder::SORT_DECREASE. |
setFirstRankName
Method definition
void OpenSearch\Util\SearchParamsBuilder::setFirstRankName( $firstRankName)
Parameter description
Parameter | Type | Description |
$firstRankName | String | The name that you want to set for the rough sort expression. |
setSecondRankName
Method definition
void OpenSearch\Util\SearchParamsBuilder::setSecondRankName( $secondRankName)
Parameter description
Parameter | Type | Description |
$secondRankName | String | The name that you want to set for the fine sort expression. |
addAggregate
Method definition
void OpenSearch\Util\SearchParamsBuilder::addAggregate( $agg)
Parameter description
Parameter | Type | Description |
$agg | array | The aggregation configurations that you want to specify. |
addDistinct
Method definition
void OpenSearch\Util\SearchParamsBuilder::addDistinct( $dist)
Parameter description
Parameter | Type | Description |
$dist | array | The deduplication configurations that you want to specify. |
addSummary
Method definition
void OpenSearch\Util\SearchParamsBuilder::addSummary( $summaryMeta)
Parameter description
Parameter | Type | Description |
$summaryMeta | array | The summary field configurations that you want to specify. |
addQueryProcessor
Method definition
void OpenSearch\Util\SearchParamsBuilder::addQueryProcessor( $qpName)
Parameter description
Parameter | Type | Description |
$qpName | array | The query analysis configurations that you want to specify. |
addDisableFunctions
Method definition
void OpenSearch\Util\SearchParamsBuilder::addDisableFunctions( $disabledFunction)
Parameter description
Parameter | Type | Description |
$disabledFunction | String | The custom parameter to be disabled. |
setCustomParam
Method definition
void OpenSearch\Util\SearchParamsBuilder::setCustomParam( $key, $value)
Parameter description
Parameter | Type | Description |
$key | String | The key of the custom parameter. |
$value | String | The value of the custom parameter. |
setScrollExpire
Sets a timeout period for each scroll query.
Method definition
void OpenSearch\Util\SearchParamsBuilder::setScrollExpire($expiredTime)
Parameter description
Parameter | Type | Description |
$expiredTime | mixed | The timeout period for each scroll query, in minutes. Example: 3m. |
setScrollId
Specifies the ID of the scroll query to be run. The ID is returned after the first scroll query is run.
Method definition
void OpenSearch\Util\SearchParamsBuilder::setScrollId(String $scrollId)
Parameter description
Parameter | Type | Description |
$scrollId | String | The ID of the scroll query to be run. |
build
Method definition
\OpenSearch\Generated\Search\SearchParams OpenSearch\Util\SearchParamsBuilder::build()
This method is used to create a SearchParams object.