Skip to content

3.10 Vector edge — similarity is the join (RELEVANT_TO + r.score)

MATCH (p:Person {name:'Ada Lovelace'})-[r:RELEVANT_TO]->(t:RelevantEmailThread)
RETURN t.subject, t.snippet, r.score
ORDER BY r.score DESC

Means: “Email threads about / related to Ada” — by meaning, not by a recorded fact.

How it executes:

  • Probe — bind p (Ada). The key here is not an id — it is embeddable text: Ada’s name.
  • Fetch — a similarity search, not a keyed lookup. The relatedThreads producer (kind: vector) embeds the anchor text (“Ada Lovelace”) and runs a top-k vector search over your email-thread summaries, returning the k nearest threads, each with a similarity score.
  • Materialize — the score lands on the edge. Each hit becomes a transient (:RelevantEmailThread:Virtual), linked (ada)-[r:RELEVANT_TO {score: 0.83}]->(t). The similarity is a property of the relationship — “how relevant is this thread to Ada” — not of the thread itself (the same thread can be more relevant to one anchor than another).
  • Run — ORDER BY r.score DESC ranks the threads by relevance; RETURN r.score exposes it.
  • Roll back.

Declared: a RelevantEmailThread type whose virtualJoins anchor on Person / Organization / Meeting via RELEVANT_TO, with keyField = the embeddable text (name / subject) and recordKeyField: matchedFor; and a producers/ entry relatedThreads (kind: vector, index: email_threads, k, minScore). See §6 for the full vector-edge model.