-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Change ExamineIndexRebuilder to public access modifier #21038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Without this being public it is not possible to override anything or resolve this internally without some ugly reflection being done at the composition layer. ExamineX has had to copy this internally to override some methods since index rebuilding should not be done for certain server roles. Similarly, for persisted indexes in managed search services like ExamineX with Azure or Elasticsearch, rebuilding on cold boot should not be done so this behavior needs to be overridden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR changes the ExamineIndexRebuilder class from internal to public access modifier to enable extensibility for packages like ExamineX that need to override index rebuilding behavior for specific scenarios (e.g., certain server roles or persisted indexes in managed search services).
Key Changes
- Changed access modifier of
ExamineIndexRebuilderclass frominternaltopublic
| namespace Umbraco.Cms.Infrastructure.Examine; | ||
|
|
||
| internal class ExamineIndexRebuilder : IIndexRebuilder | ||
| public class ExamineIndexRebuilder : IIndexRebuilder |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making the class public is insufficient for proper extensibility. The private methods CanRun(), RebuildIndex(string, TimeSpan, CancellationToken), RebuildIndexes(bool, TimeSpan, CancellationToken), and ShouldRebuild(IIndex) should also be changed to protected virtual to allow derived classes to override the rebuild behavior. Without this, developers cannot override critical rebuild logic for scenarios like excluding certain server roles or handling persisted indexes in managed search services as mentioned in the PR description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is unnecessary, by implementing the IIndexRebuilder and explicitly implementing any methods on that interface will effectively override the members on the base class, no need to declare virtual.
|
Could you just share a little more why you need this public @Shazwazza please, given it sounds like you are having to provide a custom implementation of |
|
@AndyButland sure thing - I've had to copy this class locally to ExamineX just so that I can override some methods to ensure things don't happen depending on a few things:
Its specific to ExamineX or potentially other Examine implementations where the indexes are not local lucene file based. If this was public, then I can override the methods I need by just explicitly implementing the interface members I want to override. I can look at incorporating a Decorator extension method to basically do the same thing. Happy to try that out first and will report back. |
|
OK, thanks @Shazwazza - give that a try and let me know. If it's a problem though do come back - this was public before so it wouldn't be a huge issue to make it so again; but it had been obsoleted/marked as going to be internal for a while, so we made this update for 17. |
Without this being public it is not possible to override anything or resolve this internally without some ugly reflection being done at the composition layer. ExamineX has had to copy this internally to override some methods since index rebuilding should not be done for certain server roles. Similarly, for persisted indexes in managed search services like ExamineX with Azure or Elasticsearch, rebuilding on cold boot should not be done so this behavior needs to be overridden.