search
Retrieve relevant memories, saved example queries, and entities using semantic, full-text, and entity-overlap matching to inform follow-up questions.
Instructions
Up to three-channel semantic search over memories + canonical entities.
Call this BEFORE query to surface any notes or example
queries previously saved against the entities you're
considering.
Channel 1 (entity-overlap BM25 over memories): runs when
entities and/or query is supplied. Memories whose
canonical entity tags overlap the resolved input are ranked.
Channel 2 (tantivy full-text over memories ∪ entities): runs
when question is supplied. The in-memory index covers every
memory + every searchable entity (datasource / non-hidden model /
non-hidden column / named measure / aggregation).
Channel 3 (dense embedding similarity, optional): runs when
question is supplied AND the advanced_search extra is
installed AND a provider API key is configured for the active
embedding model. Cosine similarity between the question
embedding and persisted entity/memory embeddings. Skipped with
a single warning into SearchResponse.warnings when any
precondition fails — tantivy + BM25 continue to work.
All hits (memories, example queries, entities) are fused via
Reciprocal Rank Fusion (k=60) into a single ranked
results list capped at max_results.
Empty input (no entities, no query, no question) returns the
newest memories capped at max_results, with a warning.
Args:
entities: Canonical entity reference strings.
query: Optional SlayerQuery (dict). Entities are
auto-extracted to broaden channel-1 input.
question: Free-text query for the tantivy full-text channel.
datasource: Optional datasource name. When set, scope all
three channels to that one datasource. Entity hits are
limited to docs rooted at the datasource (exact match
or dotted-path descendant). Memories surface when any
of their tagged entities is rooted at the datasource —
a memory spanning multiple datasources surfaces from
each. BM25 / IDF stats reflect only the filtered subset.
Unknown datasource raises ValueError.
max_results: Maximum total number of hits to return (default 10).
cypher_filter: Optional openCypher MATCH query returning
… AS id that pre-filters all three channels to the
returned canonical IDs. When advanced_search is not
installed, only simple
MATCH (n:Label1:Label2) RETURN n.id AS id patterns are
supported as a kind filter (multi-label uses union
semantics; allowed labels: Memory, Datasource, Model,
Column, Measure, Aggregation).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | ||
| compact | No | ||
| entities | No | ||
| question | No | ||
| datasource | No | ||
| max_results | No | ||
| cypher_filter | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |