Make it configurable after how many chars suggestions are provided

Suggestions for reviewers, accounts, account groups and projects are
provided to the user as soon as he starts typing. On systems with many
accounts, account groups and projects providing suggestions may be
expensive, especially for short query strings. Suggestions for very
short query strings are often not very useful for the user because the
list of suggestions is too big. Normally useful suggestions are only
provided if the user has typed a certain number of character that is
sufficient to limit the suggestions to a reasonable set. In this case
it makes sense to show suggestions only if the user has typed a least
a certain number of characters. Allow administrators to configure after
how many typed characters suggestions should be provided. By default
suggestions will always be provided.

Change-Id: I66bc9eeee9e1f67063fcb21dca5e2c76b20e7187
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2012-10-19 20:41:18 +02:00
parent d0b433d607
commit f957dc2675
8 changed files with 61 additions and 12 deletions

View File

@@ -19,15 +19,14 @@ import com.google.gerrit.client.RpcStatus;
import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.common.data.AccountInfo;
import com.google.gwt.user.client.ui.SuggestOracle;
import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
import java.util.ArrayList;
import java.util.List;
/** Suggestion Oracle for Account entities. */
public class AccountSuggestOracle extends HighlightSuggestOracle {
public class AccountSuggestOracle extends SuggestAfterTypingNCharsOracle {
@Override
public void onRequestSuggestions(final Request req, final Callback callback) {
public void _onRequestSuggestions(final Request req, final Callback callback) {
RpcStatus.hide(new Runnable() {
public void run() {
SuggestUtil.SVC.suggestAccount(req.getQuery(), Boolean.TRUE,