Suggest class

更新时间:
复制 MD 格式

Configures drop-down suggestion parameters for OpenSearch Industry Algorithm Edition. Use it to define a named suggestion that the search engine evaluates as users type, returning matching suggestions in real time.

Required classes

Drop-down suggestions require the following classes working together:

ClassRole
SuggestDefines the suggestion name and parameters
SearchParamsSets the query string for the suggestion request
ConfigSets the number of hits returned
SearcherClientExecutes the suggestion request; depends on the other two classes

For a complete working example, see the sample code for implementing drop-down suggestions in standard applications.

Constructors

Suggest(String suggestName)

Creates a Suggest instance with a name.

Parameters

ParameterTypeDescription
suggestNameStringThe name of the drop-down suggestion.

Suggest()

Creates a Suggest instance without a name.

Methods

setSuggestName

Sets the name of the drop-down suggestion.

Signature

Suggest setSuggestName(String suggestName)

Parameters

ParameterTypeDescription
suggestNameStringThe name of the drop-down suggestion.

Return value

Returns the current Suggest instance.

getSuggestName

Gets the name of the drop-down suggestion set on the current Suggest instance.

Signature

String getSuggestName()

Return value

Returns the suggestion name as a String.

setQuery

This method is provided by the SearchParams class. For details, see the SearchParams topic.

setHits

This method is provided by the Config class. For details, see the Config topic.