Repository navigation
refactor(store): run Search through SearchNotes - #246
Merged
Merged
Conversation
Search repeated SearchNotes' SQL, snippet and ranking. It now calls SearchNotes with only a match, so the T-0016 contract test covers the SQL that note.search runs. No change in behavior.
Contributor
Author
Cross-review
Findings (all low, not blocking) and what I did:
Revert test: exempt (a refactor; the evidence is the same tests green before and after). |
bketelsen
approved these changes
Nov 17, 2026
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.
Summary
Closes the last open item of the grooming list in #213. No change in behavior.
internal/store/search.go:(*DB).Searchrepeated the SQL of(*DB).SearchNotes: the same columns, the samesnippet(...), the samebm25(notes_fts, 10.0, 5.0, 1.0, 2.0), files.pathorder, the same limit clamp and the same error texts. NowSearchcallsSearchNoteswithQuery{Match: query}and no filters. Its signature and doc comment stay. So the contract test of task card T-0016 (internal/store/search_test.go) now covers the SQL thatnote.searchruns.Searchstill returnsnilhits on every error (SearchNotesreturns a non-nil slice), and an empty slice for an empty query. The only difference in how it runs:SearchNotesstops reading rows at the limit in Go, not with SQLLIMIT. The hits are the same.The state of every other item of #213:
Put/PutWant, the nested-tagEXISTSclause,valid/showTextMainWindow.tsx, theitem()menu helper, the syncAuthorwritten 5 times(*DB).PruneChangesinternal/vault/manager.go(#219, closed)(*DB).Search(*DB).GetVaultTestDeleteVaultuses it to prove that a delete removes the row; its removal would change an existing test(*Client).DownloadAlltransferAll, pinned by the contract test of task card T-0029 ("Do not edit")retargetTexttargetSpan, whichrewriteLinksusesNARROWinapp/src/app/narrow.tsnarrow.test.tsximports it to mock the media query; its removal would change an existing testignored/vaultPathHeldclix.OutputJSONchecks incmd/notesctl/ifat each call siteFixes #213
Risk tier
Risk tier: 1 — a refactor with no change in behavior. No changed file is in
.github/risk-paths.json.Verification
No test changed or was added. The same tests pass before and after.
4fa430d,go test -count=1 ./internal/store/: exit 0.go test -count=1 -v ./internal/store/: exit 0;TestSearch,TestSearchSnippets,TestSearchQueryandTestSearchNotespass.make check(host,umask 022): exit 0, lint 0 issues, 58 packagesok.make ci(with the nsl machine):make ui-check96 files, 819 tests passed;desktop-buildpassed. The race run failed onlyinternal/desktop/livepreviewTestDeepOrUnclosedLinkTextStaysWithinATimeBound(a 10-second wall-clock bound), with the machine's load average at about 13. That package does not importinternal/store(go list -deps). The repeatgo test -race -count=1 ./internal/desktop/livepreview/ ./internal/store/passed.Left out on purpose
See the table above.