setPersonalizedSuggestTree();
// Add personalized suggestions to list
SuggestionList list = personalizedSuggestTree.getBestSuggestions(request.getQuery());
for (int i=0;i< list.length();i++){
suggestionList.add(new DisplayableItemSuggestion(list.get(i), request.getQuery(),true));
}
r.setSuggestions(suggestionList);
callback.onSuggestionsReady(request, r);
//Get suggestions
dispatcher.execute(
new RequestGlobalSearchSuggestion(request),
new AsyncCallback<RequestGlobalSearchSuggestionResult>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(
RequestGlobalSearchSuggestionResult result) {
// add results to local suggest tree
for (Suggestion sug : result.getResponse().getSuggestions()) {
suggestionList.add(new DisplayableItemSuggestion(sug.getDisplayString(),request.getQuery(),false));
}
r.setSuggestions(suggestionList);
callback.onSuggestionsReady(request, r);
}
});