Semantic Search (RAG)
Overview
Open Note uses RAG (Retrieval-Augmented Generation) technology to implement intelligent semantic search.
Technical Architecture
Components
- ChromaDB: Local vector database
- ONNX Runtime: Local Embedding inference
- embeddinggemma-300m: Embedding model
- RRF algorithm: Result fusion ranking
Workflow
Note saved → Text chunking → Vectorization → Store in ChromaDB
↓
Search request → Query vectorization → Similarity matching → RRF fusion → Return resultsHybrid Search
Keyword Search
Traditional full-text search with exact keyword matching.
Advantages:
- Exact matching for proper nouns
- Fast
- Explainable results
Disadvantages:
- Does not understand semantics
- Cannot match synonyms
Semantic Search
Search based on vector similarity that understands search intent.
Advantages:
- Understands semantics
- Supports synonyms
- Fuzzy matching
Disadvantages:
- Computationally intensive
- Proper nouns may be less precise
RRF Fusion
Uses the Reciprocal Rank Fusion algorithm to merge two types of search results:
RRF(score) = Σ 1 / (k + rank)where k = 60 (default)
Usage
Basic Search
Enter keywords in the search box.
Semantic Search
Use Cici Agent.
Index Management
Automatic Indexing
When a note is saved, Open Note automatically:
- Extracts plain text (from Quill Delta JSON)
- Chunks text (500 tokens per chunk)
- Vectorizes chunks
- Stores them in ChromaDB
Manually Rebuild Index
Settings → Search → Rebuild Index
Applicable when:
- Changing the Embedding model
- Index corruption
- After large imports
Index Status
View index statistics:
- Number of indexed notes
- Total number of vectors
- Index size
Embedding Configuration
Local Model (Default)
Model: embeddinggemma-300m
Location: embedding_service/models/
Memory usage: ~600MBChunking Strategy
Default Strategy
- Chunk size: 500 tokens
- Overlap: 50 tokens
Adjust Strategy
Advanced users can adjust it in the configuration file.
Performance Optimization
Cache
- Query result cache
- Embedding cache
Improve Accuracy
Tips
- Use natural language: Semantic search understands natural language
- Describe intent: Do not use only keywords
- Combine methods: Keywords + semantic description
Examples
Good queries:
- "Notes about React component optimization"
- "Ideas I wrote about product design"
Poor queries:
- "React"
- "Product"
Troubleshooting
Q: No search results
- Check whether the index is complete
- Try keyword search
- Rebuild the index
Q: Search results are irrelevant
- Adjust the query description
- Check the Embedding model
- Check note index status
Q: Search is slow
- Reduce the search scope (add category/tag filters)
- Check hardware resources
Advanced Usage
Similarity Threshold
Adjust the minimum similarity (0-1):
- High threshold (0.8+): Precise matches
- Low threshold (0.5-): More results
Custom Embedding
Use a custom Embedding model (advanced).
Data Privacy
- All vector data is stored locally
- It is not uploaded to the cloud (when using a local model)
- Vector data can be cleared anytime