Skip to content

feat(search): single-type projection, iterable quad input, blue/green collection name#580

Open
ddeboer wants to merge 2 commits into
mainfrom
feat/search-single-type-projection-iterable-collection-name
Open

feat(search): single-type projection, iterable quad input, blue/green collection name#580
ddeboer wants to merge 2 commits into
mainfrom
feat/search-single-type-projection-iterable-collection-name

Conversation

@ddeboer

@ddeboer ddeboer commented Jul 9, 2026

Copy link
Copy Markdown
Member

Closes three API gaps that surfaced while migrating the Dataset Register indexer onto @lde/search / @lde/search-typesense, each of which forced a downstream workaround.

1. @lde/search: projectType(quads, searchType)

Projecting a single root type of a multi-type schema had no supported entry point: projectGraph frames every type, and building a one-type SearchSchema trips searchSchema()’s label-source validation — so consumers were forging the SearchSchema brand with as unknown as SearchSchema.

projectType scopes a projection to one root type — same framing and document shape — without building (and re-validating) a schema. projectGraph now delegates through the same framing core.

2. @lde/search: accept Iterable<Quad>

projectType and projectGraph now accept any Iterable<Quad>, not just a materialized array, so a caller merging several sources can pass a chained generator (function* () { yield* a; yield* b; }) instead of building a third full array at the projection peak.

Framing was refactored into buildSubjectIndex + frameSubjects: projectGraph scans the input once, building a single subject index every type frames off, rather than re-scanning the quads per type. This makes multi-type projection both single-pass and safe over a one-shot iterable.

3. @lde/search-typesense: expose the minted collection name

BlueGreenRebuild mints and swaps to ${name}_<timestamp> internally but did not report it, so a caller needing the concrete collection name had to issue an extra aliases().retrieve() after commit().

The run writer is now typed BlueGreenRunWriter, exposing the versioned collection as run.collection — fixed at openRun, before the first write — removing the round trip. (Exposed as a property rather than a commit() return value: the generic RunWriter.commit(): Promise<void> cannot be narrowed to Promise<string> through Promise<T>.)

Fix #579

ddeboer added 2 commits July 9, 2026 22:40
…en collection name

- Add projectType(quads, searchType) to @lde/search: scope a projection to
  one root type of a multi-type deployment without forging a one-type
  SearchSchema brand.
- Accept Iterable<Quad> in projectType and projectGraph, so callers can pass a
  chained generator merging sources instead of materializing a third array.
- Refactor framing to buildSubjectIndex + frameSubjects: projectGraph now scans
  the input once, building a single subject index every type frames off, rather
  than re-scanning per type.
- Expose the minted versioned collection (`${name}_<timestamp>`) on the
  BlueGreenRebuild run writer as `collection`, fixed at openRun, removing the
  extra aliases().retrieve() round trip after commit.
- Replace EM dashes with EN dashes in newly-added JSDoc, comments and README
  prose per the house language rule.
- Reword the frameSubjects roots-lookup comment: it tolerates an unregistered
  type as a no-op (the tested contract), rather than claiming the lookup is
  never undefined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

search: single-type projection + iterable input; search-typesense: return minted collection name

1 participant