LUCENE-9895: Hunspell: make suggest-with-timeout API public (#54)

This commit is contained in:
Peter Gromov 2021-04-07 14:52:29 +02:00 committed by GitHub
parent df25653cbd
commit 8eb582e671
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -520,7 +520,14 @@ public class Hunspell {
return suggest(word, SUGGEST_TIME_LIMIT);
}
List<String> suggest(String word, long timeLimitMs) throws SuggestionTimeoutException {
/**
* @param word the misspelled word to calculate suggestions for
* @param timeLimitMs the duration limit in milliseconds, after which the associated {@link
* TimeoutPolicy}'s effects (exception or partial result) may kick in
* @throws SuggestionTimeoutException if the computation takes too long and {@link
* TimeoutPolicy#THROW_EXCEPTION} was specified in the constructor
*/
public List<String> suggest(String word, long timeLimitMs) throws SuggestionTimeoutException {
checkCanceled.run();
if (word.length() >= 100) return Collections.emptyList();