Clarify that the FT.SEARCH count is the total number of matching documents - #3817
Open
raz-mon wants to merge 2 commits into
Open
Clarify that the FT.SEARCH count is the total number of matching documents#3817raz-mon wants to merge 2 commits into
raz-mon wants to merge 2 commits into
Conversation
The first element of the FT.SEARCH reply (total_results in RESP3) was described only as "the total number of results", which reads as the number of documents in the reply. It is the number of hits: every document that matches the query, independent of LIMIT. - Say "number of hits, that is, the number of documents that match the query" in the Return and Return information sections. - Contrast it with the LIMIT-bounded document list, with an example and a pointer to LIMIT 0 0 for the count alone. - Note the one case where the number is not a full match count: the DIALECT 4 / WITHOUTCOUNT sorting optimizations cap it at the LIMIT window (QOptimizer_UpdateTotalResults in RediSearch), and WITHCOUNT restores an accurate count. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Contributor
🧠 Redis MemoryFound 6 related items from repository history (1 new this commit):
Memory updated at 41e7e18 |
dwdougherty
requested changes
Aug 17, 2026
dwdougherty
left a comment
Collaborator
There was a problem hiding this comment.
Hi @raz-mon. Thank you for this PR. I needed to clean up the language a bit (remove "hits", etc.).
Drop "hits" in favor of "documents that match the query" throughout the Return and Return information sections, and take David's phrasing for the intro paragraphs, the three notes, and the RESP2/RESP3 reply descriptions verbatim. Kept the inline code formatting on LIMIT / 0 10 / LIMIT 0 0, which the suggestion text dropped only because it was typed as plain prose; the rest of the page and David's other suggestions backtick those tokens. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The first element of the
FT.SEARCHreply (total_resultsin RESP3) was documented only as "the total number of results", which readers reasonably take to mean the number of documents in the reply. It is the total number of documents that match the query, independent ofLIMIT.Changes to
content/commands/ft.search.mdLIMIT-bounded document list (default0 10), plus an example and a pointer toLIMIT 0 0for the total alone.DIALECT 4/WITHOUTCOUNTsorting optimizations the query stops once it has collected theLIMITwindow, so the reported number is capped there;WITHCOUNTonSORTBYrestores an accurate count. Verified againstQOptimizer_UpdateTotalResultsin RediSearch, which is applied only when the query is optimized.Scope is deliberately limited to
FT.SEARCH.FT.AGGREGATEandFT.HYBRIDuse the same "total number of results" phrasing but their count semantics differ, so they are left for a separate change.Review wording from @dwdougherty applied in 41e7e18.
🤖 Generated with Claude Code