Feature by feature
Chapter 8 of 11
Search and models
Vector and full-text indexes live on your schema types and check access policies during scoring. Training exports, live model features and regression evals read straight from your tables.
Once workspaces hold thousands of records, users expect semantic search and ML-powered features that respect the same permissions and deletes as ordinary queries. Filtering top search hits in application code after a vector scan can return empty pages whenever restricted records occupy the top ranks.
Try it
Vector and full-text indexes live on the schema type and evaluate access policies during the index scan. Query POST /search with Ada’s session token to rank permitted notes by semantic meaning and keywords.
curl https://notes.napalmdata.com/search \ -H "Authorization: Bearer $SESSION" \ -H "Content-Type: application/json" \ -d { "type": "Note", "query": "launch timeline and milestones", "limit": 5 }Vector and keyword indexes#
Pillar at work: One typed graph
Declaring indexes directly on an object type eliminates external embedding pipelines. On Note, two declarations add semantic vector search and weighted full-text search.
deferred index ext::ai::index(embedding_model := 'openai/text-embedding-3-small') on (.title ++ '\n\n' ++ .body);index fts::index on (( fts::with_options(.title, language := fts::Language.eng, weight_category := fts::Weight.A), fts::with_options(.body, language := fts::Language.eng, weight_category := fts::Weight.B)));Full-text indexes update inside the write transaction, while Napalm refreshes vector embeddings in the background using built-in embedding models or your own provider key. Indexes scale from small tables to tens of millions of vectors with no schema changes.
Background embeddings
Napalm refreshes vectors automatically from a few rows to tens of millions.
Filtered hybrid search
Vector and keyword scoring enforce access policies during the index scan.
Because access policies run during candidate scoring, requesting ten matches returns ten permitted records even when closer vectors belong to other tenants. Deleting a record removes it from search in the same commit.
Consent-gated training data#
Pillar at work: Caller-bound
Schema policies also enforce data-governance rules on training pipelines. To train a tag-suggestion model strictly on consenting customers, add allows_training to Organization from Organizations and billing and check that flag in a select policy for export service keys.
type Organization { required name: str; required slug: str { constraint exclusive; }; required allows_training: bool { default := false; }; # …members and access policies} type Note { required workspace: Workspace { on target delete delete source; }; required owner: ext::auth::Identity; required title: str; required body: str; # …editors, indexes, notify and member policies access policy service_reads_consenting allow select using (global role ?= 'service' and .workspace.org.allows_training);}Your training job exports permitted rows to Parquet shards in object storage. When an organization sets allows_training to false, subsequent dataset exports exclude every note in that organization immediately with no changes to your export script.
Consent-gated exports
Service keys export Parquet shards only from records permitted by schema policies.
Online features and evals#
Pillar at work: Compiled
At inference time, you do not need a separate Redis feature cache. One deployed query joins live record attributes, historical counts and the active model version stored in Slot in a single round trip under the caller’s session.
with note := (select Note filter .id = <uuid>$note)select note { id, title, body, workspace_name := .workspace.name, author_note_count := count(( select .workspace.<workspace[is Note] filter .owner = note.owner )), model := assert_single(( select Slot filter .name = 'note-tags' )).serving.version,}An action passes those features to your model server and writes back predictions alongside the model version. Storing evaluation cases and runs in the same schema lets CI eval queries compare candidate checkpoints against the active serving model before switching traffic.
Live feature queries
Read attributes, aggregates and the active model version in one round trip.
Regression evals
Compare candidate checkpoints against test cases stored in the same schema.
With search and model inputs governed by the schema, external assistants and autonomous agents can connect to the same project safely.