Skip to content

Export float conversion routines (or convert exported data into go types) #3206

Closed
@nikolaydubina

Description

@nikolaydubina

very important value __score in FT.SEARCH is returned as raw string not converted. users need manually convert it to float

now, this is internal redis type.

and redis go pkg does not export functions to convert it. which is bad and error prone and leads to wrong re-implementations.

Expected Behavior

Either:

  • A) provide utilities to convert internal string float representations
  • B) export standard float notation (and rest of types)
  • C) export normal native go float in exposed functions

Current Behavior

image image

Possible Solution

export this https://github.com/redis/go-redis/blob/master/internal/proto/reader.go#L192

Steps to Reproduce

  1. use FT.SEARCH __score field in Go
  2. try to convert it to float
  3. search for any methods that redis provides to convert it (there is none)

Context (Environment)

FT.SEARCH is very important. __score is very important.

and this is not even proper float... what....

INFO

# Server
redis_version:7.2.6
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:afdd7ad38aac5fcf
redis_mode:standalone
os:Linux 6.1.112+ x86_64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:epoll
atomicvar_api:c11-builtin
gcc_version:11.4.0
process_id:8

go version go1.23.0 darwin/arm64

go.mod

github.com/redis/go-redis/v9 v9.7.0

Detailed Description

Possible Implementation

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions