Query Modes
| Mode | How It Works | Best For |
|---|---|---|
| Semantic (Vector) | Converts your query to an embedding and finds documents with similar vectors | Natural language questions, related concepts |
| Keyword (BM25) | Matches exact keywords using traditional full-text search | Product codes, SKUs, technical identifiers |
| Hybrid | Fuses both result sets using Reciprocal Rank Fusion (RRF) | General-purpose production search |
Semantic Search
Semantic search converts your query into a vector embedding and returns documents whose embeddings are closest in vector space. It finds relevant content even when the user’s words don’t appear verbatim in the document.Keyword Search (BM25)
Keyword search uses the BM25 algorithm to find documents containing exact keyword matches. It’s the same mechanism behind traditional full-text search.Hybrid Search
Hybrid search runs both a semantic pass and a keyword pass, then merges and re-ranks the results using Reciprocal Rank Fusion (RRF). You get the precision of keyword matching alongside the conceptual coverage of vector search in a single ranked result set.Query Parameters
The query string. In workflow blocks this supports Jinja templating, for example
{{inputs.user_question}}.Minimum relevance threshold. Results below this score are excluded. Range is
0.0 to 1.0. See Tuning min_similarity for guidance.Maximum number of results to return.
When
true, enables hybrid mode — results from semantic and keyword passes are fused using RRF.Controls the balance between semantic and keyword search in hybrid mode.
0.0 = pure keyword, 1.0 = pure semantic. Ignored when hybrid_search is false.Filter results by metadata column values. See Filtering by Metadata for the full syntax.
Querying via Workflow Blocks
Add a Query Database Table block to any workflow to search your data at runtime.Configuration
| Parameter | Description | Default |
|---|---|---|
| Database | The Database to query | Required |
| Table | The Table within the Database | Required |
| Search Term | Query string; supports Jinja templating | Required |
| Minimum Similarity | Relevance threshold (0–1) | 0.35 |
| Hybrid Search | Enable RRF fusion | false |
| Alpha | Semantic vs. keyword balance (0–1) | 0.5 |
| Filters | Metadata filter expression | Optional |
| Limit | Max results to return | 10 |
Example Block Configuration
Working with Query Results
The block returns an array of result objects. Each result contains adetails object with relevance scores and a record object with the document’s fields:
Distance from the query in vector space. Lower values indicate higher similarity.
0.0 is identical; 1.0 is completely unrelated. Present on all results.Fused relevance score when
hybrid_search: true. Higher is better. null for pure semantic queries.The unique document identifier.
All metadata fields stored on the document, keyed by column name.
Querying via API
Basic Semantic Query
Hybrid Search Query
Using the Python SDK
Using the TypeScript SDK
Filtering by Metadata
Metadata filters let you narrow results using column values before or after the similarity ranking step. Filters use a JSON array with the format["column_id", "operator", "value"].
Available Operators
| Operator | Description | Example |
|---|---|---|
Eq | Equal to | ["status", "Eq", "active"] |
NotEq | Not equal to | ["status", "NotEq", "archived"] |
In | Value is in a list | ["category", "In", ["tutorial", "guide"]] |
NotIn | Value is not in a list | ["category", "NotIn", ["draft", "archived"]] |
Gt | Greater than | ["price", "Gt", 50] |
Gte | Greater than or equal | ["views", "Gte", 1000] |
Lt | Less than | ["created_at", "Lt", 1704067200] |
Lte | Less than or equal | ["stock", "Lte", 10] |
Glob | Pattern match (case-sensitive) | ["url", "Glob", "*/docs/*"] |
IGlob | Pattern match (case-insensitive) | ["title", "IGlob", "*quick start*"] |
And | All sub-filters must match | ["And", [[...], [...]]] |
Or | Any sub-filter must match | ["Or", [[...], [...]]] |
Filter Examples
Single column filter:Using Filters in Workflow Blocks
Apply filters dynamically with Jinja templating:Tuning min_similarity
Themin_similarity threshold cuts off results below a relevance score. Start with 0.5 and adjust based on what you observe.
| Value Range | Behavior |
|---|---|
0.0 – 0.4 | Broad — includes marginal and loosely related matches |
0.5 – 0.7 | Balanced — good default for most knowledge bases |
0.8 – 1.0 | Strict — only highly relevant, near-exact matches |
- Use
0.3–0.4for exploratory search or content discovery. - Use
0.5–0.6as a general-purpose default for production. - Use
0.7–0.8for technical documentation where precision matters. - Use
0.8+when you need near-exact semantic matches.
Tuning Alpha (Hybrid Mode)
Thealpha parameter shifts the balance between semantic and keyword scoring in hybrid mode.
| Alpha | Behavior |
|---|---|
0.0 | Pure keyword (BM25 only) |
0.3 | Mostly keyword with a semantic boost |
0.5 | Balanced — the recommended default |
0.7 | Mostly semantic with keyword precision |
1.0 | Pure semantic |
- Lower alpha (
0.2–0.4) for technical docs with specific identifiers and exact terms. - Medium alpha (
0.5) for general knowledge bases — start here. - Higher alpha (
0.7–0.9) for natural language conversations and content discovery.
Using Databases with Agents
1. Enable Databases Tools
In your agent’s Tools tab, enable the Databases query capability.2. Add an Instruction Snippet
3. Prompt Examples
- “Find troubleshooting steps for SSO login failures from the IT docs table.”
- “Search only
category = policyand summarize PTO policy changes since Jan. 1.” - “Query the sales enablement table for pricing objection handling and give me three approved responses.”
Common Query Patterns
Find Similar Documents
Recent Tutorials Only
Exclude Drafts
Multi-Category Hybrid Search
Troubleshooting
Getting no results- Lower
min_similarity— try0.3to cast a wider net. - Confirm your table has indexed documents by checking the row count in Scout Studio.
- Try a simple, general search term to confirm the data is reachable.
- Temporarily remove filters to check whether a filter condition is too restrictive.
- Raise
min_similarityto0.6or higher. - Add metadata filters to scope results to the right category or status.
- Lower
alphatoward0.3if your query uses specific terms that should match exactly.
- Confirm the document is in the correct table.
- Check for typos in filter values —
EqandInoperators are case-sensitive. UseIGlobfor case-insensitive text matching. - Try hybrid search if you’ve been using semantic-only.
- Re-sync your data source if the record was added recently and may not be indexed yet.
vector_distance values above 0.5 generally indicate weak semantic alignment. This often means:
- Your query phrasing doesn’t match how the content is written.
- The content is too short or generic to embed well.
- Consider enriching your documents with more descriptive text and re-syncing.
Best Practices
- Start with defaults —
min_similarity: 0.5,hybrid_search: true,alpha: 0.5. Adjust from there based on observed results. - Prefer hybrid search — it outperforms pure semantic or pure keyword for the vast majority of real-world queries.
- Use metadata filters — scoping to category, date, or status dramatically improves precision without sacrificing recall within the relevant subset.
- Write rich content — comprehensive, descriptive text in the
contentfield produces better embeddings and more accurate retrieval. - Test with real queries — use actual user questions (not synthetic ones) to tune thresholds and filter configurations.
Next Steps
Databases Overview
Understand the Databases data model and when to use it.
Creating Databases
Set up schemas optimized for search quality.
Sources
Keep database data fresh with automated syncs.