io.quarkus.redis.datasource.search.SpellCheckResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-redis-client Show documentation
Show all versions of quarkus-redis-client Show documentation
Connect to Redis in either imperative or reactive style
package io.quarkus.redis.datasource.search;
import java.util.List;
import java.util.Map;
import java.util.Set;
import io.quarkus.redis.runtime.datasource.Validation;
public class SpellCheckResponse {
private final Map> response;
public SpellCheckResponse(Map> response) {
this.response = response; // TODO remove words with a distance of 0
}
public List suggestions(String name) {
return response.get(Validation.notNullOrBlank(name, "name"));
}
public Set misspelledWords() {
return response.keySet();
}
public boolean isCorrect() {
return response.keySet().isEmpty();
}
// TODO What about correctly spelled words?
public static class SpellCheckSuggestion {
private final String word;
private final double distance;
public SpellCheckSuggestion(String word, double distance) {
this.word = word;
this.distance = distance;
}
public String word() {
return word;
}
public double distance() {
return distance;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy