All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.redis.datasource.search.SpellCheckResponse Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
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