pub struct Elected {
pub field: Ident,
pub label: ElectionLabel,
pub ty: Type,
pub fold: Option<Fold>,
pub tower_road: Option<Type>,
}Expand description
WHICH field of a vector declaration a knn runs over — one #[ingraph(knn)] marker’s answer.
§The type states the SHAPE; the ROLE is declared
Embedding<E, N> says a field holds N coordinates of E. It does not say this is the field
this index indexes, and welding that onto the type would make an embedding you store and do
not index undeclarable — a shape real nodes have, a caption vector kept for hydration beside
the image vector the knn runs over. Role and shape are two facts, and the record for a role is a
MARKER. It is the split the three-layer law draws between a field and its accessor, one family
over: one fact, one record.
So a vector declaration may hold any number of embedding-typed fields; the ones wearing the marker are elected; the rest are ordinary payload — stored, hydrated, never reached by a knn.
§N ELECTIONS, and the slot is one PER (field × engine)
Any number of fields may wear it, and every election is queryable. That is the shape real nodes have — an upstream operator producing two vectors, or a storage node accumulating the embeddings of several compute nodes it subscribes.
The geometry that carries them USED to be one slot holding N vector columns, on the keystone
one declaration, one slot. The engine grammar moved that keystone: a slot is (field × engine)
now (see Slot), because the per-slot laws are per-corpus and two fields sharing one corpus
move each other’s scores. What did NOT move is the column axis one grain finer — a slot may still
hold several columns of one field’s own geometry, and VectorRead::knn’s selector still says
which. Electing the same field twice is not a case either way: a marker is written on the field it
elects, so a second one is the ordinary declared-twice refusal.
§MANDATORY, including where exactly one embedding field exists
At least one, and there is no unambiguous-single fallback; the absence is the design rather than an unbuilt convenience. A fallback would readmit type-inference as a silent mechanism, so a declaration’s meaning would shift when a SECOND embedding field arrived elsewhere in the struct — the index silently indexing a field nobody elected. 必须指定 is a property of the signature or it is a property of the documentation, which is the argument that made a retrieve’s floor a positional parameter rather than an option with a default.
§ON THE FIELD, and that is what buys the spans
The marker is a token of the field’s own attribute, and the field’s TYPE is the next token along.
So this is not an Embedding<E, N> refuses AT THE TYPE — the half a reader has to go and edit
— where the retired head word named the field from outside and could only land on its own ident.
Fields§
§field: IdentThe elected field, carrying the ident’s own span — which is where both refusals about it land.
label: ElectionLabelONE embedding or a SET of them, as the FIELD’s own label states it — see ElectionLabel.
ty: TypeThe field’s declared type, VERBATIM and unread.
Every emitted projection goes through it — <#ty as EmbeddingMarker>::… — so the tokens are
the declaration’s and a type with no impl is E0277 at the author’s own spelling, carrying the
trait’s teaching sentence rather than one this crate guessed at.
fold: Option<Fold>semantics(fold(sum)) / semantics(fold = "app::MyFold") — this election’s DECLARATION-LEVEL
fold, and None where it wrote none and takes the shipped default.
§The KEY is the semantic KIND, and the value is an implementation
A semantics is a kind of decision a query makes, and the FOLD — how m per-query numbers
become one — is the first of them. So the word is keyed: the key names the kind, out of a
vocabulary this framework closes, and the value names an IMPLEMENTATION, out of a set nobody
closes. A second kind arrives as a second key and collides with nothing.
§It is the ELECTION’s, and only a SET election has one
A single embedding has one best per query vector, so there is nothing to fold and the word is
refused on an embedding-labelled field by name. The chain it takes part in is
query explicit > this > the shipped Sum.
tower_road: Option<Type>knn(searchable(tower = "…")) — the TOWER a question is walked through to reach this
column, and None where the election wrote none.
§It is the SUGAR’s word, and this emission spends none of it
A road here does not change one token of what IndexModel::emit writes. What reads it is the
front end, which forges the #[ingraph::search] recipe the author would otherwise have
written by hand and puts it through the unchanged recipe pipeline — so the model carries the
word for the same reason it carries every other one: a second front end must be able to state
the same declaration.
A TYPE and not a path, matching the arm word it becomes: the tower is a type this pass cannot resolve, and every claim about it — that it IS a tower, what it is asked, what it answers, and whether that answer meets these coordinates — is the compiler’s at the binding.
Implementations§
Source§impl Elected
impl Elected
Sourcepub const fn new(
field: Ident,
label: ElectionLabel,
ty: Type,
fold: Option<Fold>,
) -> Self
pub const fn new( field: Ident, label: ElectionLabel, ty: Type, fold: Option<Fold>, ) -> Self
One election, as the front end read it: the field, its label, its type and its fold.
PLAIN, for the model’s own reason — nothing is parsed here and nothing is checked, so the derive today and a manifest front end later build the same one.
§NOTHING IS READ OFF THE TYPE
An earlier round read E, N and S out of the field’s spelling, after stripping a Vec<…>
to find out how many of them there were. That is a macro guessing at a meaning only rustc has:
type ClipFrames = Vec<Embedding<f32, 768, Clip>> read as not an embedding, and a downstream
carrier read as nothing at all. The reader is gone, the shape comes from the LABEL, and every
other fact is projected through EmbeddingMarker in the emission.
Sourcepub fn asked_through(self, tower: Type) -> Self
pub fn asked_through(self, tower: Type) -> Self
The TOWER ROAD this election named — Elected::tower_road, set.
Beside new rather than inside it, because the road is the ONE word of an
election that most declarations do not write: a fifth parameter would put a None at every
call site that has nothing to say, which is a token a reader has to decode rather than one
that carries a fact.