tlc

package
v0.224.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package tlc harvests peer libraries' subject cataloging from TLC (The Library Corporation) LS2 PAC catalogs through the anonymous search endpoint: one POST per driver term with the term as BOTH the keyword and a Subject facet filter, so the keyword surfaces candidates and the facet enforces subject-cataloging precision. A tenant is a bare <tenant>.tlcdelivers.com subdomain or a full vanity catalog host (e.g. ls2pac.lapl.org) serving the same API.

The subject index is unscoped (LCSH, Homosaurus and others merge, and a record carries no scheme tag), so like the BiblioCommons harvest this is the inference model -- the match is the exact Homosaurus prefLabel string -- not Vega's authoritative source tag. Every probed record carried at least one typed ISBN, which is the work-match key.

Index

Constants

View Source
const Name = "tlc"

Name is the enrichment source name; suggestions carry PIPELINE provenance.

Variables

This section is empty.

Functions

This section is empty.

Types

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer is the HTTP seam, injectable for tests.

type Enricher

type Enricher struct {
	// contains filtered or unexported fields
}

Enricher harvests one or more LS2 PAC tenants.

func New

func New(hosts []string, terms []Term, opts ...Option) *Enricher

New returns the harvester for the given tenant subdomains and terms.

func (*Enricher) Describe

func (e *Enricher) Describe() string

Describe names the peer catalogs this view pulls from.

func (*Enricher) Enrich

func (e *Enricher) Enrich(ctx context.Context, works []ingest.WorkSummary) ([]ingest.Enrichment, error)

Enrich implements ingest.Enricher: per tenant (concurrent, capped) run one faceted search per driver term (memoized within the TTL), match record ISBNs back to the scoped works, and emit one suggestion per (work, term) endorsed by every corroborating tenant.

func (*Enricher) ForHosts

func (e *Enricher) ForHosts(hosts []string) ingest.Enricher

ForHosts returns a per-run view over a different tenant list (the per-job host override); the crawl cache is shared, the stats its own.

func (*Enricher) Name

func (e *Enricher) Name() string

Name implements ingest.Enricher.

func (*Enricher) RunStats

func (e *Enricher) RunStats() ingest.EnrichStats

RunStats implements ingest.StatsReporter: Total is hosts x driver terms, Batches the (host, term) crawls completed (cache-warm counted instantly), SkippedBatches the per-host terms abandoned on an error, Candidates the live matches so far. Safe mid-run.

type Option

type Option func(*Enricher)

Option configures the enricher.

func WithCacheTTL

func WithCacheTTL(d time.Duration) Option

WithCacheTTL overrides how long a completed harvest is reused.

func WithClient

func WithClient(d Doer) Option

WithClient injects the HTTP client (tests).

func WithDelay

func WithDelay(d time.Duration) Option

WithDelay overrides the politeness pause.

func WithHostConcurrency

func WithHostConcurrency(n int) Option

WithHostConcurrency overrides how many tenants crawl at once.

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger wires progress logging.

func WithMaxPages

func WithMaxPages(n int) Option

WithMaxPages caps pages fetched per (host, term).

type Term

type Term struct {
	URI    string
	Labels map[string]string
	Query  string
}

Term is one driver term: the vocabulary URI the suggestion will carry and the label used as keyword + Subject facet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL