Skip to content

Add currentUID operation and make path sortable - #210

Open
ericof wants to merge 1 commit into
masterfrom
issues-207-208
Open

ericof wants to merge 1 commit into
masterfrom
issues-207-208

Conversation

@ericof

@ericof ericof commented Oct 9, 2026

Copy link
Copy Markdown
Member

Closes #207
Closes #208

Current item operation (#208)

Adds plone.app.querystring.operation.string.currentUID ("Current item"), with no widget. It resolves to the UID of the context where the query runs, so a collection or listing block placed on an item can filter a relation index by that item (for example, "posts by this author").

The issue suggested adding it to a UID field, but core has no such querystring field. The closest candidate, getRawRelatedItems, is disabled and has no indexer for Dexterity content. So no core field uses the operation by default. The README documents how an add-on enables it on the field for its own index.

If the context has no UID, the operation adds no criterion, the same as reference.is with an empty value.

Sort by location (#207)

The path field is now sortable. ExtendedPathIndex inherits ISortIndex from PathIndex, which uses the full physical path as the sort key, so no new index or metadata column is needed.

Paths sort as strings. Because - sorts before /, a sibling such as /a-b lands between /a and /a/x.

Upgrade

The profile goes to version 16. The upgrade_to_16 step registers the operation and sets path as sortable. A test checks that the step leaves the field's other values unchanged.

Add the plone.app.querystring.operation.string.currentUID ("Current
item") operation. It resolves to the UID of the context where the query
runs, so add-ons can filter their relation indexes by the current item.
No core field uses it by default; the README shows how to enable it.

Make the path (Location) field sortable. The catalog path index already
supports sorting by full physical path; only the registry flag hid it.

Bump the profile to version 16 with an upgrade step for existing sites.

Closes #207
Closes #208
@mister-roboto

Copy link
Copy Markdown

@ericof thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@ericof

ericof commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

@jenkins-plone-org please run jobs

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter by the current item UID Support ordering by path

2 participants