feat: ingest BookOrbit highlights as chapter entries #50
Reference in New Issue
Block a user
Delete Branch "feat/bookorbit-ingest"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #47.
BookOrbit holds 234 annotations across 511 books; none of it reached knox, so recall about books I have actually read was empty.
Source
The export endpoint, not the Postgres schema — it is the contract BookOrbit maintains, and it already carries everything knox needs.
POST /api/v1/auth/login{username,password}→accessToken(15 min, login throttled 3/min, so one login per sweep)GET /api/v1/annotations/export?format=json→ the whole hub, no pagination cap (findHubAllserver-side)bookId, bookTitle, chapterTitle, text, note, color, style, origin, highlightedAtShape
One observation per book+chapter, not per highlight. A reader asks "what did I highlight in this chapter"; 234 fragments would also crowd search results with near-duplicates from a single book. Rows with no chapter bucket at book level.
Rendering mirrors BookOrbit's own Markdown export: blockquote,
Note:, and a<sub>style, color, origin, date</sub>footer.Dedupe
sha256("bookorbit:<bookId>:<chapter>")— stable when the chapter gains highlights.ContentHashover the rendered body — a new or edited highlight updates the chapter and appends a log version instead of duplicating it.Wiring
knox bookorbitfor a manual sweepknox ingestrunLocalSourcesEnabled(), sodhg.lol(KNOX_LOCAL_SOURCES=none) stays a pure replica~/.config/knox/bookorbit.env(0600), the existingkarakeep.envpatternVerification
go test ./...andgo vetgreen.Not in scope
Auto-thread per book — that would sit on #42's non-deterministic threader.
The index had no trace of anything I have read: BookOrbit holds 234 annotations across 511 books and none of it reached knox, so recall about books was empty. Entries are chapters, not highlights. A book produces a handful of dense, readable entries instead of hundreds of fragments, which is what a reader actually asks for ("what did I highlight in this chapter"). Uses the annotations export endpoint rather than the Postgres schema: it is the contract BookOrbit maintains, and it already carries book, chapter, note, style and origin. Login is one POST per sweep (the endpoint is throttled at 3/min). Fingerprint is (book, chapter); the content hash is the rendered body, so a new highlight updates the entry and appends a log version rather than creating a second copy of the chapter. The watcher deliberately has no mtime-style skip: a highlight edited in place keeps the same latest timestamp, and skipping on that would hide the edit. Wired as 'knox bookorbit', into the full 'knox ingest' sweep, and a 30-minute ticker inside LocalSourcesEnabled (the server node replicates only).