Newer Version Available

This content describes an older version of this product. View Latest

SuggestionOption Class

Options that narrow record and article suggestion results returned from a call to System.Search.suggest(String, String, Search.SuggestionOption).

Namespace

Search

SuggestionOption Methods

The following are methods for SuggestionOption.

setFilter(knowledgeSuggestionFilter)

Set filters that narrow Salesforce Knowledge article results in a call to System.Search.suggest(String, String, Search.SuggestionOption).

Signature

public void setFilter(Search.KnowledegeSuggestionFilter knowledgeSuggestionFilter)

Parameters

knowledgeSuggestionFilter
Type: KnowledgeSuggestionFilter
An object containing filters that narrow the search results.

Return Value

Type: void

Usage

setLimit(limit)

The maximum number of record or article suggestions to retrieve.

Signature

public void setLimit(Integer limit)

Parameters

limit
Type: Integer
The maximum number of record or article suggestions to retrieve.

Return Value

Type: void

Usage

By default, the System.Search.suggest(String, String, Search.SuggestionOption) method returns the 5 most relevant results. However, if your query is broad, it could match more than 5 results. If Search.SuggestionResults.hasMoreResults() returns true, there are more than 5 results. To retrieve them, call setLimit(Integer) to increase the number of suggestions results.