Skip to content

feat(content): support indexed custom field sorting#2212

Open
logelog wants to merge 4 commits into
emdash-cms:mainfrom
logelog:feat/indexed-custom-field-sorting
Open

feat(content): support indexed custom field sorting#2212
logelog wants to merge 4 commits into
emdash-cms:mainfrom
logelog:feat/indexed-custom-field-sorting

Conversation

@logelog

@logelog logelog commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds server-backed sorting for custom scalar fields that are explicitly marked indexed.

Collection fields gain an opt-in indexed flag. EmDash validates that flag against supported scalar field types, maintains a normalized index table when content changes, and allows the existing orderBy contract to sort by those field slugs. Sorting remains database-backed and cursor-safe, so it applies to the complete result set instead of only the currently loaded admin page.

This enables uses such as SEO score, ticket priority, workflow rank, or other numeric and textual metadata without introducing full-table scans.

This PR is stacked on #2194 to keep the five related content-list contributions conflict-free and reviewable at the same time. #2194 should merge first; GitHub will then narrow this PR to its unique sorting commit automatically.

Addresses the structured sorting portion of #2179.
Discussion: #1717

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

Screenshots / test output

Validated on EmDash 0.31 with Node 24 in WSL2:

  • focused core sorting, migration, repository, and schema tests: 163 passed
  • focused admin field configuration and content-list browser tests: 69 passed
  • combined five-PR integration suite: 234 core and 120 admin tests passed
  • pnpm typecheck
  • pnpm lint:quick
  • pnpm format:check
  • pnpm --filter emdash --filter @emdash-cms/admin build

@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a3f5bcc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
emdash Minor
@emdash-cms/admin Minor
@emdash-cms/cloudflare Minor
@emdash-cms/sandbox-workerd Patch
@emdash-cms/plugin-mcp-smoke Major
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/auth Minor
@emdash-cms/blocks Minor
@emdash-cms/gutenberg-to-portable-text Minor
@emdash-cms/x402 Minor
create-emdash Minor
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Scope check

This PR changes 920 lines across 35 files. Large PRs are harder to review and more likely to be closed without review.

If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs.

See CONTRIBUTING.md for contribution guidelines.

@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@2212

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@2212

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@2212

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@2212

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@2212

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@2212

emdash

npm i https://pkg.pr.new/emdash@2212

create-emdash

npm i https://pkg.pr.new/create-emdash@2212

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@2212

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@2212

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@2212

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@2212

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@2212

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@2212

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@2212

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@2212

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@2212

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@2212

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@2212

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@2212

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@2212

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@2212

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@2212

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@2212

commit: a3f5bcc

@github-actions

Copy link
Copy Markdown
Contributor

Overlapping PRs

This PR modifies files that are also changed by other open PRs:

This may cause merge conflicts or duplicated work. A maintainer will coordinate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant