-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix FT.Search Limit argument and add CountOnly argument for limit 0 0 #3338
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left comment regarding naming, I do think maybe CountsOnly
will be the best we can do right now:
CountOnly bool // when true, sends LIMIT 0 0 to only get count
@ofekshenawa when this is merged please ping the docs team to create a new doctests example with a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
@andy-stark-redis bringing this to your attention. Can we please add a doctest for this case? |
@ndyakov Sure, no problem :-) |
Adding a new boolean flag, CountOnly, to the FTSearchOptions struct to decouple count-only behavior from the default limit parameters.
Previously, it wasn't possible to input 0 0 for LimitOffset and Limit Now, with the CountOnly flag, users can explicitly signal a count-only query.
When CountOnly is set to true, the FT.SEARCH command builder appends LIMIT 0 0, ensuring that only the total count of matching documents is returned. When CountOnly is false, the provided LimitOffset and Limit values are used as usual.