Searching Documents
Master typegraph.search(): resources, weights, context, graph retrieval, prompt building, and score interpretation.
Basic Search
typegraph.search() is the primary retrieval API. Pass a natural-language string and TypeGraph returns ranked hits across the selected resources. The default weights are semantic, BM25, graph, and recency scoring fused into a final scores.fused value.
Choose Resources
resources controls what result families are eligible: documents, events, threads, entities, and facts. This is separate from scoring. For example, searching events and documents does not automatically enable graph weighting; it only controls which stored records can appear. Private memories are retrieved through typegraph.memory.recall().
Tune Weights
weights controls scoring. Set a weight to a number to include it, or false to disable it. semantic is vector similarity, bm25 is keyword ranking, graph uses relationships and provenance links, and recency boosts recent records.
Use Context and Graph Perspective
context is the only per-call actor identity object. graph selects the retrieval perspective: public users search public; internal users can search a child graph such as internal, which includes public ancestors.
Filter Documents and Buckets
Filters narrow stored resource fields. Tenant and access enforcement always comes from the initialized tenant and context; filters should not carry tenant or access-control fields.
Build an LLM Prompt
promptBuilder replaces the old context-builder naming. When enabled, the response includes prompt, an LLM-ready string assembled from the returned hits and evidence.
End-to-End RAG
A typical B2B search uses documents, events, entities, and facts together. Access controls only decide which records the caller may read; graph relationships come from extracted facts, seeded entities, event participants, and provenance links.