What is a Collection?
A collection is a named directory that QMD indexes. Collections map filesystem paths to a searchable index stored in SQLite, with each document identified by both:- Virtual path:
qmd://collection-name/relative/path.md - Document ID (docid): A 6-character hash like
#abc123
~/.config/qmd/index.yml as YAML configuration.
Creating Collections
Default Glob Pattern
If no--mask is provided, collections use the default pattern:
Virtual Paths (qmd://)
QMD uses virtual paths to reference documents across collections. The virtual path format is:Virtual Path Examples
Path Formats
QMD accepts multiple path formats and normalizes them automatically:| Input Format | Normalized To |
|---|---|
qmd://notes/file.md | qmd://notes/file.md |
//notes/file.md | qmd://notes/file.md |
qmd:////notes/file.md | qmd://notes/file.md |
Document IDs (docid)
Every document has a unique docid — the first 6 characters of its content hash. Docids are shown in search results and can be used for quick retrieval:Search results
Get by docid
Docids are content-addressable: the same document content always produces the same docid, even across collections.
Managing Collections
List All Collections
Rename a Collection
Remove a Collection
Listing Collection Contents
Use thels command to browse collections:
List entire collection
List subdirectory
List all collections
Collection Storage
Configuration Location
Collections are stored in~/.config/qmd/index.yml:
Index Database
Document content and metadata are stored in SQLite:- content: Content-addressable document storage (hash → text)
- documents: File system mapping (collection + path → hash)
- documents_fts: Full-text search index (BM25)
- content_vectors: Vector embeddings for semantic search
- vectors_vec: sqlite-vec vector index
Collection Filters
All search commands support filtering by collection:Search specific collection
Multi-get from collection
Update Hooks
Collections can define anupdate command to run before indexing (e.g., pulling from git):
Include by Default
Control which collections are searched by default:-c archive.
Best Practices
Keep collections focused
Keep collections focused
Create separate collections for different content types (notes, docs, meetings) rather than one giant collection. This makes context management and filtering easier.
Use descriptive names
Use descriptive names
Collection names should be short but meaningful. They’re used in virtual paths and CLI commands frequently.
Add context early
Add context early
Define collection and path contexts before running
qmd embed. Context is embedded with chunks and improves search quality.See Context Management for details.Customize glob patterns
Customize glob patterns
If you need to index multiple file types or exclude certain patterns, customize the
pattern field in ~/.config/qmd/index.yml.Related
- Context Management - Add hierarchical metadata to collections
- Search Modes - Search across collections
- CLI Reference - Collection management commands