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

The meaning of "-inf +inf" #1862

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion commands/zcount.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ Note: the command has a complexity of just O(log(N)) because it uses elements ra
@integer-reply: the number of elements in the specified score range.

@examples
- `-inf +inf` : 'inf' stands for infinity, meaning from least negative infinity to maximum positive infinity.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this explanation should be under "Examples". It's better to explain it in the main documentation section. We should also explain exclusive ranges with (.

We already have "The min and max arguments have the same semantic as described for ZRANGEBYSCORE.", but ZRANGEBYSCORE is deprecated and replaced by ZRANGE with the BYSCORE argument. So instead, I think we should replace "The min and max arguments have the same semantic as described for ZRANGEBYSCORE." with the same explanation that we have in the ZRANGE docs:

start and stop can be -inf and +inf, denoting the negative and positive infinities, respectively. This means that you are not required to know the highest or lowest score in the sorted set to get all elements from or up to a certain score.

By default, the score intervals specified by start and stop are closed (inclusive). It is possible to specify an open interval (exclusive) by prefixing the score with the character (.


```cli
ZADD myzset 1 "one"
ZADD myzset 2 "two"
ZADD myzset 3 "three"
ZCOUNT myzset -inf +inf
ZCOUNT myzset -inf +inf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change the whitespace here. (Suggesting self-review so you can see such mistakes.)

ZCOUNT myzset (1 3
```