In this page
Overview
This page lists sample CQL queries for common use cases around content status. They're completely standard CQL queries, so you can use them as-is, adapt them to your own needs, or freely combine them with any other CQL field or function for more complex searches.
Query samples
Current status
Contents in the status "Expired":
arch.status = "Expired"
Contents in the status #123:
arch.status.id = 123
(Searching by status ID is less readable than by name, but it is stable if the status is renamed. On the other hand, a status with a specific name can be re-created any time. Which one is optimal depends on your use case. To figure out the ID of a status, see the value of the "arch.status.id" CQL field for any content in that status through the Status details → CQL fields tab.)
Contents in the space "Foo" and in the status "Expired":
space = "Foo" and arch.status = "Expired"
Contents in the spaces "Foo" or "Bar" and in the status #123:
space in ("Foo","Bar") and arch.status.id = 123
(Searching by status ID is less readable than by name, but it is stable if the status is renamed. On the other hand, a status with a specific name can be re-created any time. Which one is optimal depends on your use case. To figure out the ID of a status, see the value of the "arch.status.id" CQL field for any content in that status through the Status details → CQL fields tab.)
Expired contents, most recently expired first:
arch.status = "Expired" order by arch.status.changedOn desc
Previous status
Contents with previous status "Up-to-date":
arch.previousStatus = "Up-to-date"
Contents transitioned from status "Expired" to "Up-to-date" in the last 7 days:
arch.previousStatus = "Expired" and arch.status = "Up-to-date" and arch.status.changedOn > now("-7d")
Contents in the spaces "Foo" or "Bar" and their current status changed from status #123:
space in ("Foo","Bar") and arch.previousStatus.id = 123
(Searching by status ID is less readable than by name, but it is stable if the status is renamed. On the other hand, a status with a specific name can be re-created any time. Which one is optimal depends on your use case. To figure out the ID of a status, see the value of the "arch.status.id" CQL field for any content in that status through the Status details → CQL fields tab.)
Status change
Contents with their status changed in the last 24 hours:
arch.status.changedOn > now("-24h")
Contents in the status "To archive" and changed to that this week:
arch.status = "To archive" and arch.status.changedOn > startOfWeek()
Contents in the status "Expired" and changed to that more than 10 days ago:
arch.status = "Expired" and arch.status.changedOn < now("-10d")
Questions?
Ask us any time.