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:
| Class | Role |
|---|---|
Suggest | Defines the suggestion name and parameters |
SearchParams | Sets the query string for the suggestion request |
Config | Sets the number of hits returned |
SearcherClient | Executes 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
| Parameter | Type | Description |
|---|---|---|
suggestName | String | The 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
| Parameter | Type | Description |
|---|---|---|
suggestName | String | The 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.