Semantic Similarity Search
Perform semantic search over ingested documents using natural language queries. The similarity search function finds relevant content by comparing query embeddings with stored document embeddings.Basic Search
How It Works
The search process:- Auto-Ingest - If needed, ingest content from the connector
- Embed Query - Convert query text to a vector embedding
- Vector Search - Find nearest neighbors using cosine similarity
- Rank Results - Sort by similarity score (1 - distance)
- Return Results - Top N most relevant chunks
Search Configuration
Query
Natural language query string:Connector
The data source to search:Store
Vector store containing embeddings:Embedder
Embedding function for query:Search Results
Each result contains:Example Result
Automatic Ingestion
Search automatically handles ingestion based on the connector’singestWhen strategy:
contentChanged (Default)
never
expired
Top N Results
By default, search returns the top 50 results. The store controls this:Filtering Results
By Similarity Threshold
By Metadata
By Document
Search Across Multiple Sources
Search multiple sources independently:Search by Document ID
Search within a specific document using the store directly:Cosine Similarity
Search uses cosine similarity to measure relevance:- Distance: 0 (identical) to 1 (completely different)
- Similarity: 1 - distance (0 to 1, higher is better)
similarity > 0.8- Highly relevantsimilarity 0.6-0.8- Moderately relevantsimilarity < 0.6- Less relevant
Performance Optimization
Limit Results
Use Smaller Models
Faster embedding with smaller models:Filter Before Processing
Batch Multiple Queries
Reuse embedder and store for multiple queries:Error Handling
- Source not found
- Embedding failure
- Database connection issues
- Invalid query
Complete Example
Best Practices
Use Natural Language Queries Write queries as natural questions or statements:- “How do I install React?” (good)
- “install react” (less effective)
Next Steps
Ingestion
Learn about document ingestion
Embeddings
Explore embedding models
API Reference
View API documentation