A semantic search system for personal notes using vector embeddings and Qdrant vector database.
- Semantic Search: Find notes by meaning, not just keywords
- Multiple Formats: Supports
.txt,.md, and.orgfiles - Smart Chunking: Automatically chunks large documents for better search
- REST API: HTTP API for integration with other tools
- CLI Interface: Command-line tools for indexing and serving
- Production Ready: Includes deployment configuration
- Python 3.9 or higher
- Qdrant vector database running on localhost:6333
- Clone the repository:
git clone <your-repo-url>
cd semantic_search_notes_v1- Install the package:
# For basic usage
pip install -e .
# For development
pip install -e ".[dev]"- Set up your notes directory:
export NOTES_DIR="/path/to/your/notes"semantic-notes-index --notes-dir ./notessemantic-notes-servecurl "http://localhost:5000/search?q=productivity&limit=5"The system can be configured via environment variables:
| Variable | Default | Description |
|---|---|---|
NOTES_DIR |
./notes |
Directory containing your notes |
QDRANT_HOST |
localhost |
Qdrant server host |
QDRANT_PORT |
6333 |
Qdrant server port |
MODEL_NAME |
all-mpnet-base-v2 |
Sentence transformer model |
CHUNK_SIZE |
500 |
Words per chunk for large documents |
FLASK_HOST |
localhost |
API server host |
FLASK_PORT |
5000 |
API server port |
- Install development dependencies:
pip install -r requirements-dev.txt- Install pre-commit hooks:
pre-commit install- Run tests:
pytest# Run all tests
pytest
# Run with coverage
pytest --cov=src/semantic_notes
# Run specific test file
pytest tests/test_config.py- Copy the service file:
sudo cp deployment/semantic_search.service /etc/systemd/system/- Start the service:
sudo systemctl enable semantic_search
sudo systemctl start semantic_search# Build image
docker build -t semantic-search-notes .
# Run container
docker run -d -p 5000:5000 \
-v /path/to/notes:/app/notes \
-e NOTES_DIR=/app/notes \
semantic-search-notesgunicorn -c deployment/gunicorn.conf.py semantic_notes.api:create_app- Model Loading: The sentence transformer model is loaded lazily and cached
- Batch Processing: Documents are indexed in configurable batches
- Memory Usage: Consider using CPU-only FAISS for lower memory usage
- Scaling: Use multiple Gunicorn workers for higher throughput (GPU setups may need single worker)
- Qdrant Connection Error: Ensure Qdrant is running on the configured host/port
- Model Download: First run may be slow due to model download
- Memory Issues: Consider reducing batch size or using smaller models
- GPU Issues: Check CUDA compatibility and install appropriate PyTorch version
Enable verbose logging:
semantic-notes-serve --verboseMIT License - see LICENSE file for details.