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

Source Facts and Built-in Keys

These keys need no enrichment. hash, hash_short and the content hash have a value once Canon has hashed the source.

Source Facts

Source facts come from what the scanner records. The set is fixed.

KeyTypeDescription
source.exttextFile extension (no dot); no value for a file with none (README, .bashrc, trail.)
source.sizenumberFile size in bytes
source.mtimetimeFile modification time
source.pathpathFull absolute path
source.rel_pathpathPath relative to the root
source.rootpathRoot path (hidden)
source.idnumberSource database ID (hidden)
source.devicenumberDevice ID (hidden)
source.inodenumberInode number (hidden)

canon facts shows the hidden ones with --all.

Built-in Keys

Short names for values used often.

KeyTypeValue
filenametextThe last path component
stemtextThe file name without its extension
exttextThe same as source.ext
sizenumberThe same as source.size
mtimetimeThe same as source.mtime
idnumberThe same as source.id
root_idnumberThe ID of the source’s root
hashtextThe content hash, content.hash.sha256
hash_shorttextThe first 8 characters of the content hash

A name that is a built-in key refers to that key in --where, --key, --group-by, worklist --emit and a pattern. A content fact imported under such a name (size, filename, id) is stored as content.size and so on, and a filter reaches it only by that full name.

The Content Hash

KeyTypeDescription
content.hash.sha256textSHA-256 content hash, recorded when Canon hashes a source

In a Pattern

{hash}, {hash_short} and {content.hash.sha256} use the content hash the lock file recorded for the source. Patterns also have {scope.rel_path}, which no filter has.