
Why Khoj Search is Different
Semantic Understanding
Finds documents by meaning, not just matching keywords
Incremental Search
Results update as you type for instant feedback
Natural Language
Ask questions naturally - “notes about AI” instead of “artificial AND intelligence”
Local or Cloud
Works offline with self-hosting or online via cloud
Getting Started
Access Search
- Web
- Obsidian
- Emacs
- Desktop
Visit app.khoj.dev - the search bar is on the homepage
Enter Your Query
Type naturally:
- “machine learning notes”
- “what I learned about nutrition”
- “project ideas from last month”
Query Filters
Refine your search with powerful filters:File Type Filters
File Type Filters
Limit results to specific document formats:Supported types:
pdf, md, org, docx, txt, notionFile Name Filters
File Name Filters
Search within specific files or folders:
Use quotes for file names with spaces
Date Range Filters
Date Range Filters
Find documents created or modified in a time range:Natural language dates:
today,yesterday,this week,last month- Or use ISO format:
YYYY-MM-DD
Source Filters
Source Filters
Filter by data source:
Tag Filters
Tag Filters
Search by tags (if your documents use them):
Search Examples
- General Research
- Personal Tracking
- Project Work
- Learning
Finding conceptual information:Khoj will find documents discussing memory, learning methods, study techniques, and cognitive science - even if they don’t use the exact phrase.
How Semantic Search Works
Understanding the technology behind the magic:Document Encoding
When you sync documents, Khoj uses a bi-encoder model to convert text into vector embeddings - numerical representations capturing semantic meaning.Each document is split into chunks and encoded separately for granular matching.
Query Encoding
Your search query is converted into the same vector space using the same bi-encoder model.
Similarity Search
Khoj compares your query vector against all document vectors, finding semantically similar content even without exact keyword matches.This happens in milliseconds thanks to efficient vector databases.
Re-Ranking
A slower but more accurate cross-encoder model re-ranks the top results, considering the full relationship between query and document.
Bi-encoder models (like Sentence Transformers) are fast at comparing many documents.Cross-encoder models are slower but more accurate, used only on top candidates.
Search vs. Chat
When should you use each?| Feature | Search | Chat |
|---|---|---|
| Speed | Instant results | Takes a few seconds |
| Output | Direct document excerpts | AI-generated summaries |
| Best For | Finding specific notes | Understanding and synthesis |
| Citations | Implicit (you see the source) | Explicit reference links |
| Follow-up | New search required | Multi-turn conversation |
Advanced Configuration (Self-Hosting)
Customize search behavior when self-hosting:Configure or Add Model
Click the
+ button to add a new search model or click an existing ID to edit.Set Bi-Encoder Model
Choose from:
- Local models from Hugging Face
- OpenAI embeddings (text-embedding-3-small, text-embedding-3-large)
- Azure OpenAI embeddings
- Ollama or other OpenAI-compatible APIs
sentence-transformers/all-MiniLM-L6-v2Configure API Settings (if using remote)
- Set
Embeddings inference endpointto your API URL - Add
Embeddings inference endpoint api key - Select
Embeddings inference endpoint type(OpenAI, Azure, etc.)
Set Confidence Threshold
Adjust
Bi encoder confidence threshold (0.0-1.0):- Lower values (0.1-0.3): More results, less strict matching
- Higher values (0.5-0.7): Fewer but more relevant results
Khoj automatically configures decent default models for general use. Only customize if you need:
- Better multi-lingual support
- Domain-specific models
- Different embedding providers
Model Recommendations
- General Purpose
- Multi-Lingual
- High Accuracy
- Privacy-First
For most users:
sentence-transformers/all-MiniLM-L6-v2(default, fast, local)- OpenAI
text-embedding-3-small(cloud, balanced)
Performance Tips
Optimize for Speed
Optimize for Speed
- Use smaller embedding models (MiniLM variants)
- Reduce confidence threshold to limit results
- Filter by file type or date to narrow the search space
Improve Accuracy
Improve Accuracy
- Use larger embedding models (MPNet, OpenAI large)
- Increase confidence threshold to filter low-quality matches
- Be more specific in your queries
Handle Large Knowledge Bases
Handle Large Knowledge Bases
- Use file filters strategically
- Organize documents into folders by topic
- Consider multiple search model configs for different document types
Troubleshooting
No results found
No results found
Possible causes:
- Documents not synced yet (check data sources page)
- Confidence threshold too high
- Query too specific or using jargon the model doesn’t recognize
- Try broader search terms
- Lower the confidence threshold in settings
- Verify documents are indexed
Irrelevant results
Irrelevant results
Possible causes:
- Confidence threshold too low
- Embedding model not well-suited to your content
- Increase confidence threshold
- Try a different embedding model
- Use query filters to narrow scope
Search is slow
Search is slow
Possible causes:
- Very large knowledge base
- Resource-intensive embedding model
- Remote API latency
- Switch to faster embedding model
- Use local models instead of API
- Add file filters to reduce search scope
Next Steps
Use Search in Chat
Chat leverages search to retrieve relevant context
Connect Data Sources
Sync more documents to expand your knowledge base
Query Filters
Master advanced filtering techniques
Keyboard Shortcuts
Search faster with hotkeys
