Google Web Toolkit
Search Google Code:

# Class MultiWordSuggestOracle

public final class MultiWordSuggestOracle
extends SuggestOracle
The default SuggestOracle. The default oracle returns potential suggestions based on breaking the query into separate words and looking for matches. It also modifies the returned text to show which prefix matched the query term. The matching is case insensitive. All suggestions are sorted before being passed into a response.

Example Table

All Suggestions | Query string | Matching Suggestions
John Smith, Joe Brown, Jane Doe, Jane Smith, Bob Jones | Jo | John Smith, Joe Brown, Bob Jones
John Smith, Joe Brown, Jane Doe, Jane Smith, Bob Jones | Smith | John Smith, Jane Smith
Georgia, New York, California | g | Georgia

## Nested Classes

MultiWordSuggestOracle.MultiWordSuggestion | Suggestion class for MultiWordSuggestOracle.

## Constructors

MultiWordSuggestOracle() | Constructor for `MultiWordSuggestOracle`.
MultiWordSuggestOracle(String) | Constructor for `MultiWordSuggestOracle` which takes in a set of whitespace chars that filter its input.

## Methods

add(String) | Adds a suggestion to the oracle.
addAll(Collection) | Adds all suggestions specified.
clear() | Removes all of the suggestions from the oracle.
isDisplayStringHTML() | Should Suggestion display strings be treated as HTML?
requestSuggestions(SuggestOracle.Request, SuggestOracle.Callback) | Generate a Response based on a specific Request.

## Constructor Detail

### MultiWordSuggestOracle

public MultiWordSuggestOracle()
Constructor for `MultiWordSuggestOracle`. This uses a space as the whitespace character.

#### See Also

MultiWordSuggestOracle(String)

### MultiWordSuggestOracle

public MultiWordSuggestOracle(String whitespaceChars)
Constructor for `MultiWordSuggestOracle` which takes in a set of whitespace chars that filter its input.

Example: If `".,"` is passed in as whitespace, then the string "foo.bar" would match the queries "foo", "bar", "foo.bar", "foo...bar", and "foo, bar". If the empty string is used, then all characters are used in matching. For example, the query "bar" would match "bar", but not "foo bar".

#### Parameters

whitespaceChars
  the characters to treat as word separators

## Method Detail

### add

public void add(String suggestion)
Adds a suggestion to the oracle. Each suggestion must be plain text.

#### Parameters

suggestion
  the suggestion

### addAll

public void addAll(Collection collection)
Adds all suggestions specified. Each suggestion must be plain text.

#### Parameters

collection
  the collection

### clear

public void clear()
Removes all of the suggestions from the oracle.

### isDisplayStringHTML

public boolean isDisplayStringHTML()
Should Suggestion display strings be treated as HTML? If true, this all suggestions' display strings will be interpreted as HTML, otherwise as text.

#### Return Value

by default, returns false

### requestSuggestions

public abstract void requestSuggestions(SuggestOracle.Request request, SuggestOracle.Callback callback)
Generate a Response based on a specific Request. After the Response is created, it is passed into Response).

#### Parameters

request
  the request
callback
  the callback to use for the response