Skip to content

Bugfix: Reindex job fix (CMS 6)#60

Merged
blueo merged 6 commits intomainfrom
bugfix/58-fix-reindex-job-cms6
Mar 3, 2026
Merged

Bugfix: Reindex job fix (CMS 6)#60
blueo merged 6 commits intomainfrom
bugfix/58-fix-reindex-job-cms6

Conversation

@adunn49
Copy link
Copy Markdown
Contributor

@adunn49 adunn49 commented Feb 23, 2026

Fixes

#58

Description

Details and how to replicate the issue are on #58

The fix is simply to add ->sort('ID') to the data object fetcher so that it consistent when indexing across multiple batches.

Test notes

Before fix:

Screenshot 2026-02-24 at 9 36 48 AM

After fix:

All expected documents have been indexed after running clear and reindex jobs.

Screenshot 2026-02-24 at 9 39 53 AM

@adunn49 adunn49 changed the title Fix issue with ReindexJob (CM6) Bugfix: Reindex job fix (CMS 6) Feb 23, 2026
@adunn49 adunn49 marked this pull request as ready for review February 25, 2026 23:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes intermittent missing documents during reindexing (CMS 6) by ensuring a deterministic ordering when fetching DataObjects in batches, addressing #58.

Changes:

  • Force consistent batch ordering in DataObjectFetcher by sorting the fetched list (default ID ASC, configurable).
  • Add a batch-oriented regression test intended to ensure all records are fetched across multiple batches.
  • Add a versioned Page test fake used by the new batching test.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/DataObject/DataObjectFetcher.php Applies a deterministic sort (default ID ASC) to prevent unstable pagination across batches.
tests/DataObject/DataObjectFetcherTest.php Adds a regression test intended to verify batch fetching returns all records.
tests/Fake/PageFakeVersioned.php Introduces a versioned Page fake for use in batching tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/DataObject/DataObjectFetcherTest.php
Comment thread tests/DataObject/DataObjectFetcherTest.php
Comment thread src/DataObject/DataObjectFetcher.php
@blueo
Copy link
Copy Markdown
Contributor

blueo commented Mar 1, 2026

@adunn49 would you be able to double check the comments around the test? I think this was a CMS6 API change (https://github.com/silverstripeltd/silverstripe-forager/blob/main/src/DataObject/DataObjectFetcher.php#L75)

The comment about always including ID is a good one but I think an enhancement if you don't have time

@blueo blueo merged commit 5c794b7 into main Mar 3, 2026
8 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.

3 participants