Skip to main content
Brainstormer’s unified search system goes beyond simple keyword matching. It combines semantic vector search, image similarity, and knowledge graph traversal to find the most relevant content across your knowledge bases.

How Search Works

When your agent receives a question (or when you search a KB manually), the system runs a multi-strategy search:
  1. Semantic search — Your query is embedded into a vector and compared against all content chunks for similarity
  2. Image search — If your query relates to visual content, image embeddings are searched alongside text
  3. Graph-informed discovery — The knowledge graph finds related entities and surfaces documents connected through relationships, even if they do not directly match the query text
Results from all three strategies are merged, deduplicated, and ranked into a single result set.

Searching Your Knowledge Base

You can search a knowledge base directly to test what content your agent would find:
  1. Navigate to Knowledge and select a knowledge base.
  2. Use the Search feature.
  3. Enter a natural language query.
  4. Review the results — each result shows the source document, relevance score, and matched text chunk.
Use natural language questions rather than keywords. “How does the return policy work?” will find better results than “return policy” because the semantic search understands intent and meaning.
Semantic search is the primary discovery method. It works by:
  1. Converting your query into a vector using Gemini Embedding 2 (the same model used to embed your content)
  2. Finding the most similar content chunks by vector distance
  3. Filtering results by a minimum similarity threshold

Hybrid retrieval

Search runs two retrieval channels in parallel and fuses them:
  • Dense (semantic) — your query is embedded with Gemini Embedding 2 and matched by vector similarity. Great for meaning and paraphrase (“how do refunds work?” finds “return policy”).
  • Sparse (keyword) — a Postgres full-text index matches exact terms. Great for product codes, names, and jargon that embeddings blur together.
The two ranked lists are combined with Reciprocal Rank Fusion — a resource that ranks highly in either channel surfaces, so exact-term matches are never lost to semantic averaging.
Hybrid retrieval is on by default. If a query has an exact identifier (a SKU, an error code, a person’s name) it now reliably surfaces even when the surrounding wording differs from your documents.

Reranking

The fused candidates are re-scored by a cross-encoder reranker (cohere/rerank-v3.5) that reads the query and each chunk together to judge true relevance — more accurate than similarity alone. If the reranker is disabled, search falls back to a lexical blend (60% vector + 25% text relevance + 15% importance weight).

Quality Controls

Context assembly (agent answers)

When an agent answers from a knowledge base, the reranked chunks are trimmed before they reach the model:
  • Diversity (MMR) — near-duplicate chunks that restate the same fact are dropped, so the agent sees a broader set of distinct evidence.
  • Token budget — total knowledge-base context is capped (~4,000 tokens) so retrieval never crowds out the system prompt, conversation history, or the model’s answer.

Learning from engagement

Retrieval also gets better on its own as your knowledge base is used. Resources your customers actually engage with — thumbs-up answers, clicked sources, conversions — earn a ranking boost, so proven content rises over time. This is floor-gated (a resource needs enough evidence before it moves) and can be turned off per knowledge base from the analytics dashboard. See Knowledge base analytics for how this is surfaced. If your knowledge base contains images (from uploads, Instagram, or other visual sources), image search runs alongside text search:
  • Images are embedded using Gemini Embedding 2’s multimodal capability
  • Text queries can match against image descriptions extracted by vision models
  • Image-to-image similarity matching is available when images are included in the query
Results from image search are tagged with discoveryMethod: "image" so you can see how each result was found.

Graph-Informed Discovery

The knowledge graph adds a third discovery dimension. When entities mentioned in your query match entities in the graph:
  1. Related entities are identified through graph relationships
  2. Documents containing those related entities are surfaced
  3. Results include a relationshipPath showing how the query connects to the discovered content
This is especially powerful for questions that span multiple documents. For example, asking about a person might surface documents about their company, projects, and collaborators — even if those documents do not mention the person directly.
Graph-informed results include suggestedFollowUps — related questions the system can suggest based on entity connections in the graph.
When an agent has multiple knowledge bases linked, search runs across all of them:
  • Each KB is searched independently (up to 3 results per KB)
  • Results are merged and deduplicated across KBs
  • Final ranking considers results from all KBs together
This lets you keep content organized in separate KBs while still getting comprehensive search results.

Search in Agent Chat

When your agent uses search during a conversation, the process is enhanced:
  • The query is built from the last 5 messages plus any attachment text, not just the latest message
  • This gives the search more context for better results
  • Results are formatted as numbered citations [1], [2] in the response
  • The sources panel shows full details for each citation

RAG Quality in Chat

The agent’s RAG pipeline includes additional safeguards:
  • Empty context handling — If no chunks pass the quality filters, the KB context section is omitted entirely rather than injecting low-quality results
  • Graceful degradation — If KB retrieval fails (network error, service unavailable), the agent continues responding without KB context rather than failing the entire request
  • Document registry — The agent receives a summary of all documents in linked KBs, giving it awareness of what knowledge is available even for questions that do not match specific chunks

Search Logs

Every search query is logged for analytics:
  • Navigate to your KB and view Search Logs
  • See queries, result counts, and relevance scores
  • Filter by date range and search type (manual vs. agent RAG)
  • Use this data to identify content gaps and improve your knowledge base
Search logs help you understand what questions your users are asking and how well your knowledge base answers them. Look for queries with low relevance scores or no results — these indicate content gaps you should fill.