~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

Code search loads more files, 200 deep at most

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:web/code-search-more

What changes

The page: code search shows its best 20 files with a "More files" button under them, which adds the next 20 below, as the tags, releases and notifications pages do (Pages and More). A file already shown is not shown again. Once the pages reach 200 files, a search that found more says so under the last, and to narrow it with lang:, file: or repo:.

dev.knotless.searchCode takes a cursor, how many files the pages before held, and answers one while there are more, until 200 files deep. Only the first page lists the languages, as the pages after add only files. skipped, the cursor parser in web/repo.rs, now takes the cursor itself, so search shares it.

Why

A search found more than its first 20 files and gave no way to see the rest. Zoekt ranks what it finds but has no offset or cursor, so a page after the first asks it for the best files up to that page's end and drops those before. Each page costs a little more than the last, so the pages stop at 200: past that a search is narrowed, not read further. Load more over numbered pages, since a ranked list is read from the top.

How it was checked

searching_code pages "needle_" one file at a time: the first answers cursor 1, the second the other repository and no cursor, and no languages. A cursor past the limit answers no files, and one that is no count is a 400. The pictures are just look of the code results with a cursor (the button), and at the limit (the note), states the recording does not hold, so no page moves.

Shortcomings

An index updated between pages can shift the order, so a file may be skipped; one shown twice is dropped. The files added are not in the address, so going back to the page shows the first 20 again.

🤖 Generated with Claude Code

more-desktop-light.png

deepest-phone-dark.png

Approved

This adds a cursor to dev.knotless.searchCode and a "More files" button to the search page, 200 files deep. I read the whole diff and found nothing that must change.

  • Paging: upto = min(skip + limit, 200) is passed to Zoekt as MaxDocDisplayCount. The first skip hits are dropped and the cursor is upto. The last page that reaches 200 gives no cursor, and a cursor past 200 gives no files. The edges are right.
  • Languages: only the first page asks for the facets, so later pages skip that query.
  • Shared parser: skipped now takes the cursor itself, and the three existing callers are updated. A cursor that isn't a number is still a 400.
  • Page: the web side dedups by repo and path, and shows the depth note only when no more pages remain and fileCount is over 200.
  • Other files: the docs, lexicon and changeset are updated with it.

I did not look at the check results. The shortcomings the body lists (order drift between pages, and the address not holding the added files) are fair trade-offs.

Merged as a32634f