Indexing

The indexing path
run_update is the whole update loop. For each changed Document it does three things:
- Extract. An extractor reads the Document and returns the concepts in it, each grounded in evidence.
- Validate. The result is validated before anything is saved.
- Save. The concepts and the Document’s version record go into the index in one transaction.
Search

The search path
- Enter by vector. The embedder picks the starting contexts. Vectors only choose where to start at each depth of the tree.
- Route down the tree. A small decision model reads the question together with the options at one level and picks one. “None of these” is always an option, so a context without an answer scores low.
- Judge concepts. The same kind of decision picks among the concepts in the chosen context.
- Follow relations. Typed relations lead from a concept to related ones. The number of hops is capped at 2.
- Resolve evidence. The resolver reads the original text at each evidence address and confirms the fingerprint. If it cannot answer in time, the hit is still returned, marked unconfirmed.
Off-topic questions
The last decision only ranks options against each other. On a small or vague index something always wins, so an off-topic question still gets an answer. An optional relevance gate fixes that. WithSearchConfig(min_cosine=...), a question whose closest concept has a lower cosine gets no answer and costs no decider call. A concept whose human-declared word appears in the question still comes back.
The gate is off by default, because a cosine depends on the embedder and on the index. Measure the cut-off with retrieval.calibrate(searcher, scope, off_topic=[...], on_topic=[...]). It returns a suggestion and says when the two groups overlap.
On the sample blueprint, a cut-off of 0.64 to 0.66 refused 18 of 24 off-topic questions and kept all 27 answerable ones. It cut decider calls by 38%, which is about 40% less search time. Questions that share the domain’s own words, such as an HR question in an IT index, still get through.
Stores

Stores and the Flight server
.lbdb file. One process can own it for writing, or many can read it. LadybugFlightStore lets other machines read and save through a server that owns the file.
The embedded store and the Flight store run the same plan, so they cannot disagree about what a save does. The store contract tests run every scenario on the in-memory store, the embedded store and the Flight store.
Architecture
The packages and what each one imports.
Vocabulary
The terms used on this page, defined once.