Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis zRange by lex does not behave like docs suggest` #93

Closed
devvit-help-bot bot opened this issue Sep 23, 2024 · 1 comment
Closed

Redis zRange by lex does not behave like docs suggest` #93

devvit-help-bot bot opened this issue Sep 23, 2024 · 1 comment
Assignees
Labels
bug synced This issue has been added to our internal tracker

Comments

@devvit-help-bot
Copy link

Details

Example gist: https://gist.github.com/fsvreddit/382476dcf4f1efe470dfb146a93a7e4d

by: lex appears to be taking the input as-is and prepending a [ to start/end unless the value is one of the special values - or +.

I should be able to work around this behaviour by deliberately manipulating the strings I put in.

Additional info

Discord message: _I don't think that zRange by lex is working quite like the official Redis documentation says it should. Imagine a sorted set with members a, b, c, d and e.

const res = await context.redis.zRange("myKey", "[b", "[d", { by: "lex" }); should return ["b", "c", "d"] because the [ indicates an inclusive range, and const res = await context.redis.zRange("myKey", "(b", "(e", { by: "lex" }); should return just ["c"] because ( indicates exclusive. However in both cases I just get an empty array.

If I omit the ( or [, I get b, c and d however. This implies to me some processing is happening on the server rather than the inputs being taken as-is._

Message author: big.wheel

Discord link: https://discord.com/channels/1050224141732687912/1242689538447507458/1287404638345367612

@pl00h pl00h added bug enhancement New feature or request synced This issue has been added to our internal tracker and removed enhancement New feature or request labels Sep 23, 2024
@shannon-feng shannon-feng self-assigned this Oct 10, 2024
@shannon-feng
Copy link

I made a few updates that allow devs to prepend the start/stop input with ( or [. If the input doesn't have ( or [ in front of it, then the server will prepend an inclusive bracket [ by default.

additionally, you can pass in - or + as input to indicate negative or positive infinity strings.

Developer docs have been updated to reflect the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug synced This issue has been added to our internal tracker
Development

No branches or pull requests

2 participants