Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Facts Reference

Facts are key-value metadata. See Concepts: Facts for an overview.

Namespaces

NamespaceDescription
source.*Facts about the file on disk (path, size, mtime)
content.*Facts about the content (hash, EXIF, mime type)
object.*Object-level properties

The content. prefix is optional when querying. For example, Make=Apple is equivalent to content.Make=Apple.

Values

Facts can hold three value types:

TypeExamplesNotes
Text"Apple", "image/jpeg"Strings; quote if contains spaces
Number1024, 3.14, -5Integers or decimals
Timestamp1704067200Unix timestamps; enable date modifiers

Modifiers

Transform values using | syntax:

Time Modifiers

For timestamp values (like source.mtime or EXIF dates):

ModifierOutputExample
year4-digit year2024
month2-digit month07
day2-digit day23
hour2-digit hour (24h)14
minute2-digit minute30
second2-digit second45
dateISO date2024-07-23
timeISO time14:30:45
datetimeISO datetime2024-07-23T14:30:45
yearmonthYear-month2024-07
weekISO week number30
weekdayDay of week (Mon=1)2
quarterQuarter (1-4)3

String Modifiers

ModifierDescriptionExample
lowercaseConvert to lowercaseJPGjpg
uppercaseConvert to uppercasejpgJPG
capitalizeCapitalize first letterappleApple
stemFilename without extensionphoto.jpgphoto
extFile extensionphoto.jpgjpg
shortFirst 8 charactersabc123def456abc123de

Numeric Modifiers

ModifierDescription
bucketGroup into ranges (1-10, 10-100, etc.)
bucket(a,b,c)Custom ranges (<a, a-b, b-c, >c)

Example: source.size|bucket groups file sizes into human-readable ranges.

Path Accessors

Python-style indexing for path values:

SyntaxMeaning
key[-1]Last segment (filename)
key[0]First segment
key[1:3]Slice segments 1 and 2
key[:-1]All but last segment

Accessors can be combined with modifiers:

source.rel_path[-1]        → IMG_001.jpg
source.rel_path[-1]|stem   → IMG_001
source.rel_path[0]         → photos

Pruning Facts

The canon prune command can delete facts to free database space.

Excluded Entity Facts

Delete facts for sources or objects you’ve excluded:

# Dry-run: show what would be deleted (default)
canon prune --excluded-facts

# Delete facts for both excluded sources and objects
canon prune --excluded-facts --yes

# Delete only source facts (excluded sources)
canon prune --excluded-facts=source --yes

# Delete only object facts (excluded objects)
canon prune --excluded-facts=object --yes

This is useful when you’ve excluded sources/objects you’re not interested in archiving and want to reclaim the database space used by their metadata.

Other Prune Options

FlagDescription
--stale-factsDelete source facts where the file changed since recording
--orphaned-objectsDelete objects with no present sources (and their facts)

All prune operations are dry-run by default. Add --yes to execute.

See Also