* @param numItems
*/
private static void retrieveSuggestions(HttpServletRequest request,
ProcessRetrieveResponse response, SuggestTree index, String term,
Integer numItems) {
Node suggestions = index.getBestSuggestions(term);
System.out.println(index.size() + " , " + suggestions.listLength());
if (suggestions == null) {
response.addError(RetrieveStatusCodes.NO_SUGGESTIONS_MATCHING_TERM);
return;
}
for (int i = 0; i < Math.min(suggestions.listLength(), numItems); ++i) {
String suggestString = suggestions.getSuggestion(i);
String key = suggestions.getKey(i);
response.addSuggestion(suggestString, key);
}
}