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

io.quarkus.redis.datasource.autosuggest.ReactiveTransactionalAutoSuggestCommands Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package io.quarkus.redis.datasource.autosuggest;

import io.quarkus.redis.datasource.ReactiveTransactionalRedisCommands;
import io.smallrye.mutiny.Uni;

/**
 * Allows executing commands from the {@code auto-suggest} group (requires the Redis Search module from Redis stack).
 * See the auto-suggest command list for further information about
 * these
 * commands.
 * This API is intended to be used in a Redis transaction ({@code MULTI}), thus, all command methods return {@code Uni}.
 *
 * @param  the type of the key
 */
public interface ReactiveTransactionalAutoSuggestCommands extends ReactiveTransactionalRedisCommands {

    /**
     * Execute the command FT.SUGADD.
     * Summary: Add a suggestion string to an auto-complete suggestion dictionary
     * Group: auto-suggest
     *
     * @param key the suggestion dictionary key
     * @param string the suggestion string to index
     * @param score the floating point number of the suggestion string's weight
     * @return A {@code Uni} emitting {@code null} when the command has been enqueued successfully in the transaction, a failure
     *         otherwise. In the case of failure, the transaction is discarded.
     */
    default Uni ftSugAdd(K key, String string, double score) {
        return ftSugAdd(key, string, score, false);
    }

    /**
     * Execute the command FT.SUGADD.
     * Summary: Add a suggestion string to an auto-complete suggestion dictionary
     * Group: auto-suggest
     *
     * @param key the suggestion dictionary key
     * @param string the suggestion string to index
     * @param score the floating point number of the suggestion string's weight
     * @param increment increments the existing entry of the suggestion by the given score, instead of replacing the score.
     *        This is useful for updating the dictionary based on user queries in real time.
     * @return A {@code Uni} emitting {@code null} when the command has been enqueued successfully in the transaction, a failure
     *         otherwise. In the case of failure, the transaction is discarded.
     */
    Uni ftSugAdd(K key, String string, double score, boolean increment);

    /**
     * Execute the command FT.SUGDEL.
     * Summary: Delete a string from a suggestion index
     * Group: auto-suggest
     *
     * @param key the suggestion dictionary key
     * @param string the suggestion string to index
     * @return A {@code Uni} emitting {@code null} when the command has been enqueued successfully in the transaction, a failure
     *         otherwise. In the case of failure, the transaction is discarded.
     */
    Uni ftSugDel(K key, String string);

    /**
     * Execute the command FT.SUGGET.
     * Summary: Get completion suggestions for a prefix
     * Group: auto-suggest
     *
     * @param key the suggestion dictionary key
     * @param prefix is prefix to complete on.
     * @return A {@code Uni} emitting {@code null} when the command has been enqueued successfully in the transaction, a failure
     *         otherwise. In the case of failure, the transaction is discarded.
     */
    Uni ftSugget(K key, String prefix);

    /**
     * Execute the command FT.SUGGET.
     * Summary: Get completion suggestions for a prefix
     * Group: auto-suggest
     *
     * @param key the suggestion dictionary key
     * @param prefix is prefix to complete on.
     * @param args the extra argument, must not be {@code null}
     * @return A {@code Uni} emitting {@code null} when the command has been enqueued successfully in the transaction, a failure
     *         otherwise. In the case of failure, the transaction is discarded.
     */
    Uni ftSugget(K key, String prefix, GetArgs args);

    /**
     * Execute the command FT.SUGLEN.
     * Summary: Get the size of an auto-complete suggestion dictionary
     * Group: auto-suggest
     *
     * @param key the suggestion dictionary key
     * @return A {@code Uni} emitting {@code null} when the command has been enqueued successfully in the transaction, a failure
     *         otherwise. In the case of failure, the transaction is discarded.
     */
    Uni ftSugLen(K key);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy