search_knowledge
Hybrid semantic + full-text search tool
Hybrid search combining semantic similarity with full-text keyword matching using Reciprocal Rank Fusion (RRF).
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | Yes | - | Natural language search query (1-10000 chars) |
limit | number | No | 10 | Maximum results to return (1-50) |
fullTextWeight | number | No | 1.0 | Weight for keyword matching (0-2) |
semanticWeight | number | No | 1.0 | Weight for semantic similarity (0-2) |
tags | string[] | No | - | Filter to documents with ALL specified tags |
sourceType | enum | No | - | Filter by source: note, file, or url |
minScore | number | No | - | Minimum relevance score threshold (0-1) |
Example Request
Response
How It Works
Reciprocal Rank Fusion (RRF)
textrawl runs two parallel searches:
- Full-Text Search: PostgreSQL tsvector matching for exact keywords
- Semantic Search: pgvector cosine similarity for meaning
Results are combined using RRF:
Where k = 60 (standard RRF constant).
Weight Tuning
| Use Case | fullTextWeight | semanticWeight |
|---|---|---|
| Exact phrases | 1.5-2.0 | 0.5-1.0 |
| Conceptual search | 0.5-1.0 | 1.5-2.0 |
| Balanced (default) | 1.0 | 1.0 |
| Keyword-only | 2.0 | 0 |
| Semantic-only | 0 | 2.0 |
Tip: Start with default weights and adjust based on results. Higher semantic weight helps with paraphrased queries.
Filtering
By Tags
Filter to documents containing ALL specified tags:
Only returns documents tagged with both work AND project-x.
By Source Type
Filter by how the document was created:
| sourceType | Description |
|---|---|
note | Created via add_note tool |
file | Uploaded via CLI or Web UI |
url | Web content (future feature) |
By Score Threshold
Filter out low-relevance results:
Caution: Scores are relative. A 0.7 threshold may filter out relevant results for broad queries.
Error Responses
Database not configured
OpenAI not configured
Search failed
Best Practices
- Start broad, then narrow: Begin without filters, add them if too many results
- Use semantic weight for questions: Increase
semanticWeightfor natural language queries - Use full-text weight for keywords: Increase
fullTextWeightfor specific terms - Combine with get_document: Search returns chunks, use
get_documentfor full context - Check score distribution: If all scores are low, try rephrasing the query