Console commands

Two groups, because building records and cutting an artifact are genuinely separate operations — and a deploy script usually wants them at different moments.

Records

# every index, with record counts and what is stale
php craft caffeine/index/status

# map content into records — dirty only, or everything
php craft caffeine/index/build [handle]
php craft caffeine/index/build --all

# what Caffeine would build for one element, without building anything
php craft caffeine/index/preview products 1234

# mark an index stale so the next build revisits every record
php craft caffeine/index/touch products

build without --all rebuilds only the records marked stale, which is what the queue job does. --all walks every source from scratch and prunes anything that no longer qualifies — an entry moved to a different section is not deleted, it simply stopped belonging, and nothing else would notice.

Artifacts

# compile and publish — one index, or all of them
php craft caffeine/artifact/publish [handle]

# publish even if nothing changed
php craft caffeine/artifact/publish products --force

# what is live, and whether it is behind the CMS
php craft caffeine/artifact/status

# read the published artifact back and compare it to a fresh compile
php craft caffeine/artifact/verify products

# recent versions, with size and build time
php craft caffeine/artifact/versions products

# retire versions beyond keepVersions
php craft caffeine/artifact/prune [handle]

--force

A publish normally does nothing when the compiled artifact is identical to what is already live. --force overrides that, and exists for the one case the checksum cannot see: the ledger says an identical artifact is published, but the files are not actually there — a wiped web root, a new environment restored from a database dump, a filesystem handle repointed somewhere else.

verify

Worth running in CI, or after a deploy. It reads the published artifact out of the store, decodes it and compares it against a fresh compile, so it exercises the encoder, the decoder and the publisher against your real content — and answers the operational question at the same time: is what visitors are being served actually current?

A deploy

php craft up
php craft caffeine/index/build --all
php craft caffeine/artifact/publish

On a normal deploy where the index definition has not changed, the publish will usually find nothing to do and say so — which is the correct outcome, and costs a compile rather than a write.

More in AI & Search

Pairs well with Caffeine

Getting found, by people and by machines. Faceted search, recommendations, GEO and instant indexing, image similarity, and tools that keep links and the search index honest.