Searcher reads concepts and the context tree through a ConceptSource, which any store can be. The How it works page gives the outline. This page gives the steps.
One search
1
Serve filter
Keep only servable concepts:
stable, not merged, with at least one piece of evidence that is not stale and is allowed by the query’s access_filter. The concept must also be at or above the required trust tier and match any hard facets (type, context, or an extra key).2
Entry
Take the best contexts at each depth, and the best concepts, by cosine, within one depth at a time.
3
Route
A model, the decider, judges which child context probably holds the answer, level by level, and follows a child only above
min_route. It looks at every depth together, not strictly top-down. This follows the “collapsed tree” idea of recursive summary trees.4
Judge
The decider judges the concepts of the contexts it reached. A concept is returned only above
min_score.5
Declared words
A concept whose human-declared word appears in the question is returned with a fixed score, unless the decider scored it higher.
6
Hop
From the best concepts, follow typed relations in both directions, at most 2 hops and
fanout per hop, with a visited set. A concept reached over one relation scores the seed’s score times decay and the relation’s weight. A relation to a concept that is not served is not followed.7
Gate
Optionally, if no concept is as close as
min_cosine, the decider is not asked and only declared-word concepts are returned.8
Resolve
Optionally, read the live source to confirm each quote.
What a hit carries
Each hit carries:addressscorepath, which readsquery → concept → relation → … → conceptevidence_idcontext_path, the labels from the top level downaccess_labels- when resolved, the
resolutionand thecontent
The query
AQuery says where and how far to search. Lesson 1 builds one:
hops is capped at 2. A larger value is rejected with a validation error.
Tunable numbers
These are the fields ofSearchConfig, with their defaults.
Searcher also keeps a SearchStats for the last search: the number of decider and embed calls, the entry, routed and judged contexts, the declared-word matches, the closest concept’s cosine, and whether the gate refused the question. Use it in tests and to measure cost.
min_route and min_score are tuned values, not constants. Scores across levels may not be calibrated, so measure on your own question set. Search reads every servable concept on each call, and the vector column dominates that cost.
The relevance gate
The decider only ranks options against each other, so on a small or vague index something always wins. WithSearchConfig(min_cosine=...), a question whose closest concept has a lower cosine gets no answer and costs no decider call. 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%, 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.