Skip to main content
Khoj Search delivers instant, intelligent results from your documents using advanced semantic understanding. Unlike traditional keyword search, Khoj understands meaning and context to find what you’re actually looking for.
Khoj Search Results

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

1

Access Search

Visit app.khoj.dev - the search bar is on the homepage
2

Enter Your Query

Type naturally:
  • “machine learning notes”
  • “what I learned about nutrition”
  • “project ideas from last month”
You don’t need exact keywords - describe what you’re looking for
3

Review Results

Results appear instantly with:
  • Highlighted matches - Key passages that matched your query
  • Relevance scores - How closely each document matches
  • Quick preview - See context without opening the full document

Query Filters

Refine your search with powerful filters:
Limit results to specific document formats:
machine learning file:pdf
meeting notes file:md
Supported types: pdf, md, org, docx, txt, notion
Search within specific files or folders:
file:"project-notes.md" action items
file:"/work/2024/" quarterly review
Use quotes for file names with spaces
Find documents created or modified in a time range:
dt>="last week" meeting notes
dt>="2024-01-01" dt<="2024-03-31" goals
Natural language dates:
  • today, yesterday, this week, last month
  • Or use ISO format: YYYY-MM-DD
Filter by data source:
source:notion project planning
source:github code review notes
Search by tags (if your documents use them):
tag:work tag:urgent
Complete Filter Reference →

Search Examples

Finding conceptual information:
techniques for better memory retention
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:
1

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.
2

Query Encoding

Your search query is converted into the same vector space using the same bi-encoder model.
3

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.
4

Re-Ranking

A slower but more accurate cross-encoder model re-ranks the top results, considering the full relationship between query and document.
5

Results Display

Final results are presented with relevance scores and highlighted excerpts.
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?
FeatureSearchChat
SpeedInstant resultsTakes a few seconds
OutputDirect document excerptsAI-generated summaries
Best ForFinding specific notesUnderstanding and synthesis
CitationsImplicit (you see the source)Explicit reference links
Follow-upNew search requiredMulti-turn conversation
Workflow tip: Use Search to find documents, then use Chat to understand and synthesize information from multiple sources.

Advanced Configuration (Self-Hosting)

Customize search behavior when self-hosting:
1

Access Admin Panel

Navigate to: http://localhost:42110/server/admin/database/searchmodelconfig/
2

Configure or Add Model

Click the + button to add a new search model or click an existing ID to edit.
3

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
Example local model: sentence-transformers/all-MiniLM-L6-v2
4

Configure API Settings (if using remote)

  • Set Embeddings inference endpoint to your API URL
  • Add Embeddings inference endpoint api key
  • Select Embeddings inference endpoint type (OpenAI, Azure, etc.)
5

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
Changing the threshold affects how many documents are retrieved for chat
6

Mark as Default

Ensure the name field is set to default for your active configuration.
7

Restart and Re-index

  • Restart the Khoj server
  • Important: Re-sync all documents to create embeddings with the new model
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

For most users:
  • sentence-transformers/all-MiniLM-L6-v2 (default, fast, local)
  • OpenAI text-embedding-3-small (cloud, balanced)

Performance Tips

  • Use smaller embedding models (MiniLM variants)
  • Reduce confidence threshold to limit results
  • Filter by file type or date to narrow the search space
  • Use larger embedding models (MPNet, OpenAI large)
  • Increase confidence threshold to filter low-quality matches
  • Be more specific in your queries
  • Use file filters strategically
  • Organize documents into folders by topic
  • Consider multiple search model configs for different document types

Troubleshooting

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
Solutions:
  • Try broader search terms
  • Lower the confidence threshold in settings
  • Verify documents are indexed
Possible causes:
  • Confidence threshold too low
  • Embedding model not well-suited to your content
Solutions:
  • Increase confidence threshold
  • Try a different embedding model
  • Use query filters to narrow scope
Possible causes:
  • Very large knowledge base
  • Resource-intensive embedding model
  • Remote API latency
Solutions:
  • 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

Build docs developers (and LLMs) love