FT.SUGADD

Syntax
FT.SUGADD key string score [INCR] [PAYLOAD payload] 
Available in:
Redis Stack / Search 1.0.0
Time complexity:
O(1)

Add a suggestion string to an auto-complete suggestion dictionary

Examples

Required arguments

key

is suggestion dictionary key.

string

is suggestion string to index.

score

is floating point number of the suggestion string's weight.

The auto-complete suggestion dictionary is disconnected from the index definitions and leaves creating and updating suggestions dictionaries to the user.

Optional arguments

INCR

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.

PAYLOAD {payload}

saves an extra payload with the suggestion, that can be fetched by adding the WITHPAYLOADS argument to FT.SUGGET.

Return

FT.SUGADD returns an integer reply, which is the current size of the suggestion dictionary.

Examples

Add a suggestion string to an auto-complete suggestion dictionary
127.0.0.1:6379> FT.SUGADD sug "hello world" 1
(integer) 3

See also

FT.SUGGET | FT.SUGDEL | FT.SUGLEN

RediSearch


History

  • Starting with Redis version 2.0.0: Deprecated PAYLOAD argument
RATE THIS PAGE
Back to top ↑