StackExchange / StackExchange/StackExchange.Redis
SortedSetRangeByValueAsync method returns incorrect results when filtering by value range
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.2k
- Forks
- 1.6k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
I am experiencing an issue with the SortedSetRangeByValueAsync method in the StackExchange.Redis library. The method seems to return incorrect results when filtering by a specific value range.
StackExchange.Redis version: 2.7.33
.NET version: 7
Redis server version: 6.2.11
var min = "[67aacca2-04ba-425b-bca3-fdaf074cd04e";
var max = "(67aacca2-04ba-425b-bca3-fdaf074cd04e";
var results = await database.SortedSetRangeByValueAsync("UserConnectionIds", min, max);
foreach (var result in results)
{
Console.WriteLine(result);
}
Expected Result:
Only the elements within the specified range (those starting with "67aacca2-04ba-425b-bca3-fdaf074cd04e") should be returned.
Actual Result:
The method returns elements outside the specified range, including GUIDs starting with "3fa", which should not be included based on the provided range.
Is there a specific way to format the min and max parameters for the SortedSetRangeByValueAsync method?
Are there any known issues or limitations with using this method for filtering by value ranges?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at SortedSetRangeByValueAsync and compare the supplied min and max syntax with Redis sorted-set range semantics; reproduce the report using the stated versions and code sample. Done means establishing whether the returned values violate the documented range behavior and, if so, correcting the behavior or parameter handling with a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, redis
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100