Say "at least" when an API search with no total was cut to fit - #116
Merged
Merged
Conversation
'oc gem search rails' answered "20 pages match, ranked by the site's own search:". RubyGems answers a search with a bare array of 30 and no total, the page keeps the first 20, and with no total the count fell back to the 20 shown, so nothing said the list went on or that a second page exists. With no total, the count is now how many results the answer carried, and when that is more than the page shows it reads as a floor: "at least 30 pages match, ranked by the site's own search, top 20 shown:". A list that fits is counted as before, and a site that reports its total (npm, crates.io, MDN) is unchanged. Co-Authored-By: Claude Opus 5.5 <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.
oc gem search railssays 20 gems match and gives no sign that the list goes on:RubyGems answers a search with a bare array of 30 per page and no total (
&page=2has 30 more). The results page keeps the first 20, and with nototalfield in the definition the count fell back to the 20 it shows, so the "top 20 shown" note never appeared.After:
With no total, the count is now how many results the answer carried, and when that is more than the page shows it is stated as a floor. A list that fits is counted exactly as before ("5 pages match"), and the sites that report a total (npm, crates.io, MDN) render the same.
Test.
tests/apisearch.test.jsgains one test with a RubyGems-shaped answer: 30 results give "at least 30 pages match, ..., top 20 shown:", and 5 results give "5 pages match, ranked by the site's own search:". Onmainthe first assertion fails (it reads "20 pages match"). Full suite: 311 tests, 308 pass, 3 skipped, 0 fail.Left alone. oc still fetches one page of results; paging the API is a different change.
🤖 Generated with Claude Code