Skip to content

Conversation

rohnsha0
Copy link
Member

@rohnsha0 rohnsha0 commented Mar 24, 2025

@rohnsha0 rohnsha0 requested a review from MrTango March 24, 2025 00:49
@mister-roboto
Copy link

@rohnsha0 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!

@rohnsha0 rohnsha0 requested a review from davisagli March 24, 2025 01:38
Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's double-check that the docs render properly. We've been having some issues with pull request previews on RTD due to our misconfiguration.

You will need to add the new methods in the file docs/api/index.md so they show up in https://ploneapi--578.org.readthedocs.build/api/index.html#api-portal.

docs/portal.md Outdated
% self.assertIn('modified_by', catalog.indexes())
% self.assertIn('creation_user', catalog.indexes())

This function returns a list of the names of the indexes that were added.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move above.

Suggested change
This function returns a list of the names of the indexes that were added.

@required_parameters("wanted_indexes")
def add_catalog_indexes(wanted_indexes, reindex=True, logger=None):
"""
Add the specified indexes to portal_catalog if they don't already exist.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Add the specified indexes to portal_catalog if they don't already exist.
Add the specified indexes to portal_catalog.

- logger: Optional logger instance
Returns:
- List of newly added index names
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- List of newly added index names
- List of newly added index names
Example:
- :ref:`portal-add-catalog-indexes-example`

@stevepiercy
Copy link
Contributor

@rohnsha0 RTD previews are not rendering correctly. We have a fix in #506 that you can cherry-pick here, or wait until that PR is merged and merge it into your branch.

Specifically, the changes in these files need to be ported:

Thank you!

Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor tweaks and a question. Otherwise looks great! Thank you!

@stevepiercy
Copy link
Contributor

#506 was just merged to allow docs to build. Updating branch. Let's see if that fixes this PR.

@stevepiercy
Copy link
Contributor

Docs are rendering correctly now.

@rohnsha0
Copy link
Member Author

rohnsha0 commented Mar 25, 2025

#506 was just merged to allow docs to build. Updating branch. Let's see if that fixes this PR.

ah, there was another error which got fixed somehow.

something again with version mismatching or some dist

Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new line

Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's get a technical review from another person.

@github-project-automation github-project-automation bot moved this from In Progress to Approved in Plone Documentation Mar 25, 2025
@stevepiercy
Copy link
Contributor

@plone/classicui-team could I get a review from one of y'all?

Copy link
Member

@petschki petschki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some concerns about this implementation:

  • the issue mentioned is outdated and creating indexes/metadata with genericsetup is simple and works like it should. (No more dataloss on recreation)
  • the fact, that reindex here is per default True when adding an index would cause troubles with long running tasks on large sites
  • adding a metadata means, that you have to either reindex your whole catalog or write your own script, which reindexes your needed objects.
  • If it comes to special indexes (like DateRecurringIndex) there is no way to properly configure the RRULE with this method, so you have to write your own script again.

that said, I dont really see a benefit from this ... I'd put more effort porting this doc here to plone 6+ https://5.docs.plone.org/external/plone.app.dexterity/docs/advanced/catalog-indexing-strategies.html

@github-project-automation github-project-automation bot moved this from Approved to In Progress in Plone Documentation Mar 25, 2025
@stevepiercy
Copy link
Contributor

I'd put more effort porting this doc here to plone 6+ https://5.docs.plone.org/external/plone.app.dexterity/docs/advanced/catalog-indexing-strategies.html

There are open issues in plone/documentation waiting for a content expert.

https://github.com/plone/documentation/issues?q=is%3Aissue%20state%3Aopen%20catalog

The files are already converted to MyST on the 5.2-myst branch.

https://github.com/plone/documentation/tree/5.2-myst/5.2-myst

Comment on lines +479 to +483
def add_catalog_indexes(indexes_to_add, reindex=True, logger=None):
"""Add the specified indexes to portal_catalog if they don't already exist.
:param indexes_to_add: [required] List of tuples in format (index_name, index_type)
:type indexes_to_add: list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I pass index properties here? This is essential.

@jensens
Copy link
Member

jensens commented Mar 26, 2025

The current implementation is incomplete.

Overall I do not think we need this feature. We introduce just another way to do the same we can do better using GenericSetup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Add add indexes method to api.portal
5 participants