Skip to content

PLIP: Remove or fix getRawRelatedItems index #4236

@mauritsvanrees

Description

@mauritsvanrees

This is too small to really be called a PLIP, but some changes are needed across multiple packages, and we should only do this in a Plone minor release, so let's go for it. And actually, there are two very different ways in which we could handle this, so a PLIP with a discussion is good.

PLIP (Plone Improvement Proposal)

Plone 6.1 still adds a getRawRelatedItems index to the portal catalog. This is from the Archetypes days, so it is useless, and is expected to be empty. We should no longer add this.

Alternatively though, we could add an indexer that makes this work for Dexterity items.

Responsible Persons

Proposer: Maurits van Rees, @mauritsvanrees

Seconder:

Abstract

Remove all traces of getRawRelatedItems from Plone. Can be done in 6.2 or 6.3.

Motivation

Every extra index slows down indexing operations.

Assumptions

No one is using this index. Theoretically someone may have written a custom indexer, making this actually functional, but then it is up to them to add the index. Castle CMS actually has one. Even nick adds it, probably just to keep it the same as Plone.

Proposal & Implementation

In Plone coredev 6.2 in parts/packages we find it in the following places:

$ ack getRawRelatedItems
Products/CMFPlone/profiles/default/catalog.xml
144:         name="getRawRelatedItems"
146:    <indexed_attr value="getRawRelatedItems" />

plone/app/locales/locales/da/LC_MESSAGES/plone.po
2863:#. index description of index: getRawRelatedItems
5238:#. index friendly name of index: getRawRelatedItems

plone/app/content/browser/contents/__init__.py
207:            "getRawRelatedItems",

plone/app/querystring/tests/testQueryParser.py
74:            "getRawRelatedItems",

plone/app/querystring/profiles/default/registry.xml
609:           prefix="plone.app.querystring.field.getRawRelatedItems"

plone/restapi/tests/http-examples/querystring_get.resp
551:        "getRawRelatedItems": {

plone/restapi/tests/http-examples/querystring_get_contextual.resp
551:        "getRawRelatedItems": {

Those should all be removed.

We need an upgrade step:

  • Remove the index.
  • Remove the plone.app.querystring.field.getRawRelatedItems registry record.
  • If we want to be nice: check with uniqueValues if the index is really empty. If not: keep it, but log a warning.

Deliverables

  • Products.CMFPlone: remove the index from the GS profile.
  • plone.app.locales: remove the comment about this index from the Danish translation. This can be done already.
  • plone.app.content: remove it from the list that mentions it: columns which should be ignored in folder contents. It does not hurt to have it there though, and this could also be done as a final cleanup after all other changes have been merged.
  • plone.app.querystring: remove it from the GS profile and the test.
  • plone.restapi: remove it from the tests.
  • Documentation: add a short note in the Plone 6.2 migration guide.

Risks

This will break sites if people actually use the index. But we can mitigate this risk by checking if the index is really empty before removing it in an upgrade step.

Alternatives

Alternatively, we could revive this index, and make it functional in Dexterity. I suppose the castlecms indexer will work.

The index name is weird for those without ancient Archetypes knowledge, so it could be renamed, but that would make things harder, so we could also live with the old name.

In fact, I was looking for something like this, although in my case it would have been more useful to have this information in the brain metadata.

So alternative:

  • Keep the index, keep the name.
  • Add an indexer to get the related uuids.
  • Add this as a metadata column.
  • Add an upgrade step to add the column. Reindex the index. We could be smart about this by using the relation catalog to look for items with a relatedItems relation, and only reindex these.

I must say, I (Maurits) like the alternative. Should be a bit less work as well.

Update: never mind. I thought I needed the alternative in a project, but in fact I don't. See my comment below.

Participants

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    New (drafts)

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions