Skip to content

Content Drive: Status filter (Archived, Unpublished, Locked) on drive search and in the toolbar #37066

Closed

Description

@zJaaal

Description

Content Drive needs a Status filter (Archived, Unpublished, Locked): the backend clauses on POST /api/v1/drive/search and the multiselect in the toolbar. None of the three predicates is expressible on the endpoint today.

Merged 2026-08-24. This ticket absorbed #37067, which was the frontend half. They were one vertical slice split across two tickets, each restating the same contract. #37067 is closed as merged here.

Semantics reversed 2026-08-24 (see the comment thread). This ticket originally specified AND. It now specifies OR. Everything below reflects OR.

Backend

Current state, verified against the code:

Status Exists in BrowserQuery? Notes
Archived Partially showArchived (BrowserQuery.java:55, builder :470) exists but is inclusive: it drops the cvi.deleted = false clause (BrowserAPIImpl.java:1926), returning archived plus everything else.
Unpublished No showWorking / the form's live flag is the live-only axis, which is a different question, not the inverse.
Locked No No field, no builder method, no SQL clause, no ES clause. Nothing in the drive package references locked.

Confirmed against the full BrowserQuery field list (:44-83) and all 42 builder methods. There is no raw Lucene passthrough either: BrowserQuery.luceneQuery (:66) is fed only by withFilter / withFileName and is never read by BrowserAPIImpl.

Semantics: OR, not AND. Selecting several statuses widens the result set — UNPUBLISHED + LOCKED returns content that is unpublished or locked. This matches every other Content Drive multiselect (base type, content type, language): more checkboxes, more results.

This reverses the ticket's original wording. The case for AND was that these are independent boolean flags on the same contentlet_version_info row, so intersecting them is meaningful. It is — for one of four combinations:

Combination Under AND Under OR
ARCHIVED + UNPUBLISHED redundant — identical to ARCHIVED alone, since archiving removes the live version (ESContentletAPIImpl.java:3833) "everything with no live version"
ARCHIVED + LOCKED almost always empty — needs a self-lock or a CMS-Admin archive "archived or checked out"
UNPUBLISHED + LOCKED useful — "drafts checked out by someone" "drafts or checked out"
all three empty in practice "anything not cleanly published"

The decisive argument is consistency. Every other chip in that toolbar row widens on selection, and no UI affordance can convey that one of them inverts the rule — a user who checks a second box and gets fewer results reads that as a bug. The other filters being OR is forced by their single-valued nature (an item has exactly one base type, so AND would always be empty), but that reasoning is invisible to the user; all they learn is the pattern.

Accepted cost: "unpublished and locked" is no longer expressible in Content Drive. If that proves to be a real need it belongs in a later refinement that makes the combining rule explicit in the UI, rather than implicit and inverted.

Legacy is a precedent for the predicates, not for how they combine. The legacy Content Search portlet combines the three in the AND sense on its backend (ContentletAjax.java:1010-1021) while exposing a mutually exclusive dropdown in its UI (view_contentlets.jsp:695-698) — so it offers neither the multiselect nor the union:

if (!showDeleted) "+deleted:false" else "+deleted:true"
if (filterLocked)    "+locked:true"
if (filterUnpublish) "+live:false"

The Archived chip needs a new exclusive clause. The existing showArchived is inclusive and must stay that way: the legacy Site Browser checkbox (view_browser.jsp:145) depends on it. Add the exclusive variant alongside it rather than changing it.

Target predicates:

Chip SQL disjunct (selectQuery) ES term (buildPureESQuery)
Archived cvi.deleted = true deleted:true
Unpublished cvi.live_inode is null live:false
Locked cvi.locked_by is not null locked:true

Columns exist (postgres.sql:550-552); the locked ES field is indexed (ESMappingAPIImpl.java:527).

The archived baseline sits OUTSIDE the OR group. Excluding archived content is the drive's pre-existing default (appendExcludeArchivedQuery), not a fourth status. The selected statuses are OR-ed together and that group is AND-ed against the baseline, which only ARCHIVED lifts:

-- [UNPUBLISHED, LOCKED]
  and cvi.deleted = false                                        -- baseline, still applies
  and ( cvi.live_inode is null or cvi.locked_by is not null )    -- the selected statuses

-- [ARCHIVED, LOCKED]                                            -- baseline lifted
  and ( cvi.deleted = true or cvi.locked_by is not null )

Folding the baseline into the group is the bug to avoid: [UNPUBLISHED, LOCKED] would read (deleted = false or ...) and match essentially every row — a filter that silently stops filtering. A single selection degenerates to a one-disjunct group, so [ARCHIVED] is still exactly cvi.deleted = true.

showWorking must learn about the new statuses. BrowserQuery.java:151 (showWorking = showWorking || showArchived) also has to be true when ARCHIVED or UNPUBLISHED is selected. Both states imply no live version, so otherwise selectQuery joins on live_inode (:1947) and the filter silently returns nothing.

Both query paths need the clauses, but only one is the default. doElasticSearchTextFiltering (:477) switches on BROWSE_API_HEURISTIC_TYPE, which defaults to HYBRID_SINGLE_CHUNKED_QUERY_ES (:695). In hybrid, the SQL query supplies the inode set and ES only text-filters within it, so the SQL clauses apply even with text in the search box. buildPureESQuery (with its hardcoded +deleted:false at :610) runs only under BROWSE_API_HEURISTIC_TYPE=PURE_ES. That is a supported config, so it must be updated too, otherwise the filters silently no-op there.

Frontend

A multiselect chip filter with three options (Archived, Unpublished, Locked), sitting after the Workflow filter and before the Locale filter (dot-content-drive-toolbar.component.html:62-63) — giving shared-assets | content-type | workflow | status | locale. Nothing selected means today's behavior: archived hidden, everything else returned.

Why there. The row has exactly one real dependency edge and it must not be broken: the workflow filter derives its scheme list from the content-type selection (getSchemesByContentTypes), so content type and workflow stay adjacent. The field-filter menu is likewise derived from content type (it only materializes at exactly one selected type). Nothing else in the row is coupled — the content-type filter reads only baseType/contentType, so there is no dependency on the shared-assets toggle, and status's three options are fixed.

Status therefore depends on nothing and goes where it costs least: beside workflow, so the two lifecycle questions ("where is this in its lifecycle, and is anyone holding it") still read as a pair, but after it rather than between workflow and the selection it reads from. Content type keeps its position, and only locale shifts right by one.

Current state: archived: false is hardcoded in the search request at dot-content-drive.store.ts:135. That pin is removed and driven by the new filter instead.

Folders carry no status. When any status is selected, folders must drop out of the results, consistent with how the store already handles the other narrowing filters (dot-content-drive.store.ts:137-146) and how ContentDriveHelper sets showFolders(false) for the workflow filter.

Navigation is inherited, not built. Keep status as a key in the flat filters bag rather than giving it its own query param. That way it rides the existing machinery unchanged: decodeFilters on init (dot-content-drive.store.ts:546), the location.subscribe popstate re-hydration (:571), setPath never touching filters so it survives folder browsing, and mapQueryParamsToCDParams (dot-content-drive-navigation.service.ts:121) carrying the whole filters string through the legacy editor round-trip.

One decode trap. The decodeByFilterKey entry (status: multiSelector) is not optional. Unknown keys fall through to a comma sniff in decodeFilterValue, so status:ARCHIVED would decode to the string 'ARCHIVED' while status:ARCHIVED,LOCKED decodes to an array. Every reader does filters()?.status?.length, which is 8 for that string — the filter would appear to work until someone selected exactly one status.

Acceptance Criteria

Backend

  • AbstractDriveRequestForm accepts a new status field (list of ARCHIVED, UNPUBLISHED, LOCKED); defaults to empty
  • BrowserQuery carries the statuses (field + builder method), mirroring the workflow filter plumbing in beaf846d51
  • BrowserQuery's showWorking derivation is true when ARCHIVED or UNPUBLISHED is selected
  • ContentDriveHelper maps the form field onto the builder
  • Empty selection preserves today's behavior exactly: archived excluded, everything else returned
  • ARCHIVED alone returns only archived content (cvi.deleted = true), not archived plus everything else
  • UNPUBLISHED alone returns only content with no live version, and excludes archived content
  • LOCKED alone returns only content with a lock held, and excludes archived content
  • Multiple statuses combine with OR (UNPUBLISHED + LOCKED returns content that is either)
  • Adding a status never shrinks the result set; each pair equals the union of its members
  • ARCHIVED is the only status that admits archived content into the results
  • The archived baseline is emitted outside the OR group, so a selection without ARCHIVED still excludes archived content
  • The existing inclusive archived flag is unchanged and the legacy Site Browser "Show Archived" checkbox still behaves as before
  • Filters apply identically with and without a text search under the default HYBRID_SINGLE_CHUNKED_QUERY_ES heuristic
  • buildPureESQuery honors the statuses (and stops hardcoding +deleted:false) so BROWSE_API_HEURISTIC_TYPE=PURE_ES returns the same results
  • An invalid status value returns 400, consistent with how userSearchable rejects unknown keys
  • Regression: ContentDriveWorkflowArchiveStepTest still passes. appendWorkflowQuery owns cvi.deleted per branch when an archive-target step is selected (:2262-2279); a status selection combined with a workflow archive-step filter must not produce an empty or double-constrained result
  • Integration tests cover each status alone, each pair, all three, the empty default, and the never-shrinks property
  • openapi.yaml regenerated and committed alongside the annotation changes

Frontend

  • Status multiselect renders after the Workflow filter and before the Locale filter, with options Archived, Unpublished and Locked; Content Type and Workflow stay adjacent
  • Options use i18n keys via DotMessagePipe, following the content-drive.* key convention
  • Selecting one or more statuses sends them on the drive-search request and the results widen accordingly
  • Unpublished + Locked returns content that is either
  • Empty selection sends no status and preserves current behavior (archived content stays hidden)
  • archived: false is no longer hardcoded in the request at dot-content-drive.store.ts:135
  • Selections round-trip through the URL via the shared filter bag, with an explicit decodeByFilterKey entry so a single selected status decodes as an array, not a string
  • The selection survives page reload, folder navigation, browser Back/Forward, and an editor round-trip — exactly like every other Content Drive filter
  • Selections are cleared by the existing "Clear all" action
  • Folders are excluded from results whenever any status is selected
  • The active selection is reflected as chips, consistent with the other toolbar filters
  • An empty result set shows the standard empty state, not an error
  • data-testid on the control and its options; [attr.aria-label] on the control
  • Jest/Spectator tests cover: single selection, multiple selection, clearing, URL round-trip (including the single-value case), navigation survival, and folders being excluded when a status is active

Priority

Medium

Additional Context

Spec and design: #37170 carries the Spec-Kit spec.md, data-model.md and the API contract for this work.

Reference commits for shape and sizing:

  • beaf846d51 original workflow filter, shows the plumbing cost for a new drive-search filter (~65 lines across form + BrowserQuery + helper)
  • f92f939296 archive-target workflow steps, the precedent for touching cvi.deleted inside BrowserAPIImpl (184 lines impl, 478 lines of tests)

The backend half is one OR-ed group plus two touched lines where cvi.deleted is already decided, so it should land well under the f92f939296 footprint.

Reference for the frontend: the workflow filter (dot-content-drive-workflow-filter.component.ts) is the closest existing toolbar filter for chip rendering, URL encoding and the folder-exclusion pattern — but it carries a service, two caches, a request-id guard and a reconcile pass because its options are fetched. Three fixed options need none of that.

Not in scope: the Shared Assets / System Host toggle, tracked separately in #34760.

Related: #37067 (closed, merged into this ticket), #34760, #33999 (parent epic).

Activity

  1. added theissue type on Aug 14, 2026
  2. moved this from New to Current Sprint Backlog in dotCMS - Product Planningon Aug 14, 2026
  3. changed the title [-]Add Status filters (Archived, Unpublished, Locked) to /api/v1/drive/search[/-] [+]Content Drive: Status filter (Archived, Unpublished, Locked) on drive search and in the toolbar[/+] on Aug 24, 2026
  4. zJaaal commented on Aug 24, 2026

    @zJaaal
    MemberAuthor

    Retitled and rewritten (2026-08-24) to absorb #37067, now closed. Both halves of the Status filter live here; every criterion from #37067 is carried over verbatim under the Frontend heading.

    Analysis and edit by Claude (Claude Code), posted from @zJaaal's account.

  5. zJaaal commented on Aug 24, 2026

    @zJaaal
    MemberAuthor

    Body updated 2026-08-24: the Status semantics are now OR, not AND. Flagging rather than letting the ticket and the spec diverge.

    Why it changed. The AND wording came from my own earlier rewrite of this ticket (see the previous comment), not from a team decision, and it did not survive the plan phase. The argument for AND was that these are independent flags one item can hold at once, so intersecting them is meaningful. It is — for one of four combinations:

    Combination Under AND Under OR
    Archived + Unpublished redundant — identical to Archived alone, since archiving removes the live version "everything with no live version"
    Archived + Locked almost always empty "archived or checked out"
    Unpublished + Locked useful — "drafts checked out" "drafts or checked out"
    all three empty in practice "anything not cleanly published"

    The original ticket had to document two of those as "expected, not a bug." Needing that disclaimer was the design objecting.

    The decisive point is consistency: every other chip in that toolbar row widens on selection, and nothing in the UI can convey that one of them inverts the rule. A user who checks a second box and gets fewer results reads it as broken. The other filters being OR is forced by their single-valued nature — an item has exactly one base type — but that reasoning is invisible to the user; all they learn is the pattern.

    Accepted cost: "unpublished and locked" is no longer expressible in Content Drive. Recorded in the spec's Assumptions rather than dropped quietly. If it turns out to matter, it belongs in a later refinement that makes the combining rule explicit in the UI.

    Also changed in this edit:

    • Toolbar placement pinned to between Shared Assets and Content Type (the row reads broadest-scope-first), rather than left unspecified.
    • Navigation made an explicit requirement: the selection must survive reload, folder browsing, Back/Forward and an editor round-trip. It gets that for free by staying a key in the shared filters bag — the ticket now says not to give it its own query param.
    • Added the archived-baseline-outside-the-OR-group rule, the showWorking derivation, and the single-value URL decode trap (status:ARCHIVED decodes to a string, not an array, without an explicit decodeByFilterKey entry).

    Spec, data model and API contract are in #37170.

    Analysis and edit by Claude (Claude Code), posted from @zJaaal's account.

  6. 24 remaining items

  7. KevinDavilaDotCMS commented on Sep 3, 2026

    @KevinDavilaDotCMS
    Contributor

    Passed QA

    Tested in main 4a82203

    2026-09-03.16-33-06.mov

    Test data: created a dedicated content type (QA37066Ticket) with its own workflow scheme (QA37066 Support Workflow, copied from System Workflow), plus a control set on webPageContent / System Workflow. Each group has 6 contentlets covering every relevant state: published (baseline), unpublished-only, archived, locked, unpublished+locked, archived+locked. All prefixed QA37066 - for easy lookup.

    Verified directly against POST /api/v1/drive/search:

    Filter Result
    No status (default) Archived excluded, everything else returned
    ARCHIVED only Only archived content
    UNPUBLISHED only Only content with no live version; archived excluded
    LOCKED only Only locked content; archived excluded
    UNPUBLISHED + LOCKED Union of both (3 items) — no shrinkage
    ARCHIVED + LOCKED Union of both, including the non-locked archived item — confirms the OR group is built correctly, not just "locked archived"
    All three Everything except the clean-published baseline

    Content Type + Workflow interaction:

    • Selecting a Content Type narrows the Workflow dropdown to only the scheme(s) attached to it.
    • Workflow combines with Content Type via AND (4 → 2 archived items once a specific scheme was selected).
    • Status stays fully independent of Workflow — content archived under different schemes both surface under Status=Archived with no scheme distinction, as expected.
  8. removed their assignment
    on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions