Hi all,

I am struggling to understand how to use the PAYLOAD functionality within the FT.SUGADD and FT.SUGGET commands.

When I add a suggestion with a payload using:

FT.SUGADD autocomplete “John Smith” 1.0 PAYLOAD “Aged 25”

And then try to retrieve this suggestion, the returned result does not change when I include the WITHPAYLOAD flag

FT.SUGGET autocomplete “John” WITHPAYLOAD -> “John Smith”

FT.SUGGET autocomplete “John” -> “John Smith”

I would like to attach a payload when adding suggestions (preferably an object containing multiple key value pairs) and have that returned with my FT.SUGGET call.

Is this possible? I’m not sure if I am doing this the wrong way.



The optional parameter is WITHPAYLOADS and not WITHPAYLOAD
I suggest you use a client library to abstract the syntax and avoid this sort of confusion.

Thanks Dvir for the prompt response!

I was actually using the Go client to test out this functionality, but could not get a payload attached when attempting to use it, so I reverted back to the redis-cli to try and get a better understanding of how the payload worked.

The real use case which I am trying to solve is with the use of the Go Client and the Autocompleter type.

When I add a suggestion with a corresponding payload, using Autocompleter.AddTerms(redisearch.Suggestion{Term: “foo”, Score: 1.0, Payload: "bar}), and then try to retrieve that Suggestion based off an input string using the Autocompleter.Suggest(“fo”, 10, True), the Suggestions returned in the []Suggestion response, have no value for the Payload entity.

Eg. [{Term: “foo”, Score: 0.8747, Payload: “”}]

After taking a look at the implementation of the Suggest function, it doesn’t look like the Payload value is ever assigned on the returned Suggestion struct.

Do you happen to know if this is a known issue or if there is an alternate way to get the Payload returned from an Autocomplete query?

It’s just not implemented in the client, I guess the code predates that feature and we forgot to add it.

Feel free to add a PR to the Go client!

Hi Dvir,

Pull Request has been posted, I am unable to add you as a reviewer, but are you able to take a look. https://github.com/RedisLabs/redisearch-go/pull/6



Thanks Ryan, really appreciated.
I requested a couple of small changes in the review, plus I’d appreciate it if you could cover the option in the unit test.