Database schema¶
DoppelSort stores its index in a single SQLite database. The schema is versioned
with PRAGMA user_version and migrated on open, so older indexes keep working.
Images table¶
Image metadata includes:
image_pathcontent_hashperceptual_hashtimestampfile_sizemtime
Faces table¶
Face metadata includes:
idimage_pathbboxembeddingembedding_normtimestampcontent_hashperceptual_hashimage_id
Schema version 2 enables foreign keys, references images(id) from
faces.image_id, and enforces UNIQUE(image_id, embedding). Embeddings are
stored as L2-normalized float32 BLOBs.
The metadata supports:
- exact duplicate files through
content_hash; - perceptual similarity metadata through
perceptual_hash; - image records and their associated face detections.
Index metadata¶
scan records model_name and embedding_dim in index_meta. match
refuses an index built with a different model or embedding dimension instead of
comparing incompatible vectors. Legacy indexes without index_meta remain
readable.
Duplicate grouping¶
db info and db optimize share one grouping key: content_hash plus the
embedding, or image_path plus the embedding for legacy rows without a content
hash. NULL content hashes fall back to the image path, so unrelated legacy
rows are not merged.
duplicate_groupscounts groups containing more than one row.duplicate_rowscounts the excess rows thatdb optimizewould remove.
Compatibility¶
The database uses SQLite WAL mode. When scanning an older index, DoppelSort adds missing image and hash metadata columns while preserving existing face rows.