Skip to content

Bugfix: Reindex job fix (CMS 5 Branch)#59

Merged
blueo merged 9 commits into1from
bugfix/58-reindex-job-fix
Feb 27, 2026
Merged

Bugfix: Reindex job fix (CMS 5 Branch)#59
blueo merged 9 commits into1from
bugfix/58-reindex-job-fix

Conversation

@adunn49
Copy link
Copy Markdown
Contributor

@adunn49 adunn49 commented Feb 19, 2026

Fixes

#58

Description

Details about the issue and how to replicate it are added to #58

The simple fix here is to add ->sort('ID') rather than fetching objects where the default 'Sort' is applied. This ensures that it is consistent and reliably indexes all expected documents.

Added unit test to cover this scenario.

@adunn49 adunn49 changed the base branch from main to 1 February 19, 2026 01:24
// And then just a quick extra sanity check that fetching 2 Documents only returns 2 Documents
$documents = $fetcher->fetch(2);
// make sure we fetched all the documents
$this->assertCount($totalDocuments, $fetchedDocumentIDs);
Copy link
Copy Markdown
Contributor Author

@adunn49 adunn49 Feb 23, 2026

Choose a reason for hiding this comment

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

Without the ->sort('ID') fix, the fetched document count for this test is about 75.

PageFake::class,
PageFakeVersioned::class,
DataObjectFake::class,
TagFake::class,
Copy link
Copy Markdown
Contributor Author

@adunn49 adunn49 Feb 23, 2026

Choose a reason for hiding this comment

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

I was having trouble running the module tests locally from within my skeleton project. Adding these seemed to fix the issue.

@adunn49 adunn49 marked this pull request as ready for review February 23, 2026 20:11
@adunn49 adunn49 changed the title Bugfix: Reindex job fix Bugfix: Reindex job fix (CMS 5 Branch) Feb 23, 2026
Copy link
Copy Markdown
Contributor

@blueo blueo left a comment

Choose a reason for hiding this comment

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

thanks for picking this up!

Comment thread src/DataObject/DataObjectFetcher.php Outdated
{
$list = DataList::create($this->dataObjectClass);
// sort records by id so that their order can be guaranteed across multiple fetches
$list = DataList::create($this->dataObjectClass)->sort('ID');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is a great pickup as the issue here is subtle and only appears with a large number of pages. The only thing I'd add is could we make this sort configurable? Sorting by ID will mean the oldest created pages will be indexed first. This is mostly fine but potentially it would be useful to provide a different order (eg newest first).

Copy link
Copy Markdown
Contributor

@blueo blueo left a comment

Choose a reason for hiding this comment

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

good stuff 🥇

@blueo blueo merged commit 0d776e3 into 1 Feb 27, 2026
18 checks passed
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.

2 participants