LOG.debug("getSuggestions: " + options.tokens);
if (lookup == null) {
LOG.info("Lookup is null - invoke spellchecker.build first");
return EMPTY_RESULT;
}
SpellingResult res = new SpellingResult();
for (Token t : options.tokens) {
String term = new String(t.buffer(), 0, t.length());
List<LookupResult> suggestions = lookup.lookup(term,
options.onlyMorePopular, options.count);
if (suggestions == null) {
continue;
}
if (!options.onlyMorePopular) {
Collections.sort(suggestions);
}
for (LookupResult lr : suggestions) {
res.add(t, lr.key, ((Number)lr.value).intValue());
}
}
return res;
}