Search: stream results as the scan finds them - #160
Merged
Merged
Conversation
The headline pass and full scan were two separate requests, so page one (almost always all headline matches) arrived as a single block and the later batch changed nothing visible. - /api/search?stream=1 returns NDJSON: headline count, then headline matches in batches of 5, then the full page once the body scan lands - Final order is newest-first across all matches again, so later matches displace earlier ones; rows slide to their new positions and the count climbs as each batch arrives - Plain JSON response kept for the 404 page's search box and spellcheck Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
RonanHevenor
force-pushed
the
fiddle-with-the-search-bar
branch
from
September 17, 2026 20:51
77ed351 to
c7a728d
Compare
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.
Follow-up to #159: results still arrived as one block, because page one is almost always entirely headline matches, so the second request changed nothing visible.
/api/search?stream=1now returns NDJSON:Rows render as each batch arrives, later matches displace earlier ones (rows slide to their new positions), and the count climbs as it goes.
X-Accel-Buffering: nokeeps nginx from buffering the stream.The plain JSON response is unchanged for the 404 page's search box and the spellcheck retry.
Measured on production before this change: headline pass 0.29–0.41s, full scan 1.1–3.2s.
🤖 Generated with Claude Code