Concepts
Semantic Search
How textrawl finds relevant documents
textrawl uses vector similarity to find documents related to your query, not just keyword matching.
Keyword vs Semantic Search
| Keyword Search | Semantic Search |
|---|---|
| Exact matches | Meaning matches |
| "auth config" → "auth config" | "auth config" → "setting up authentication" |
| Fast, precise | Understands synonyms |
| Misses paraphrases | May miss exact terms |
Hybrid Approach
textrawl combines both:
- Full-text search: PostgreSQL tsvector for keywords
- Semantic search: pgvector cosine similarity for meaning
- RRF fusion: Reciprocal Rank Fusion combines results
How It Works
Query: "How do I set up user login?"
│
┌────┴────┐
│ │
▼ ▼
Keywords Embedding
│ │
▼ ▼
FTS Match Cosine Similarity
│ │
└────┬────┘
│
▼
RRF Fusion
│
▼
Ranked ResultsQuery Examples
| Query | Best Match | Why |
|---|---|---|
| "PRJ-12345" | Exact document | Keyword match |
| "authentication setup" | Auth docs | Semantic + keyword |
| "how do I log in" | Auth docs | Semantic understanding |
Tuning Weights
Control the balance:
{
"fullTextWeight": 1.5,
"semanticWeight": 0.5
}Higher fullTextWeight favors keyword matches.
Or:
{
"fullTextWeight": 0.5,
"semanticWeight": 1.5
}Higher semanticWeight favors semantic understanding.
Default is 1.0 for both (balanced).