Context
PR #35609 introduced SearchAPIImpl (the phase-aware router) and OSSearchAPIImpl. The existing OSSearchAPIImplIntegrationTest tests the OS implementation directly against empty indices. The following coverage gaps were identified in the PR review and deferred to this issue.
Missing test coverage
1. Phase routing selects the correct provider
- Phase 0 / 1 →
ESSearchAPIImpl is used
- Phase 2 / 3 →
OSSearchAPIImpl is used
- Requires injecting
SearchAPIImpl (not OSSearchAPIImpl directly) and setting Config.setProperty(MigrationPhase.FLAG_KEY, ...) per test, cleaning up in @After.
2. ES fallback in Phase 2
- When
OSSearchAPIImpl throws, PhaseRouter.readChecked retries against ES.
- Requires simulating an OS failure (e.g. wrong index name) while ES is healthy.
3. searchRaw permission injection filters results for non-admin users
- Needs at least one indexed document + a non-admin user with explicit role/permission setup.
executeSearch() lines 263–300 inject a permission filter; today this is untested end-to-end against OS.
Reference files
SearchAPIImpl: dotCMS/src/main/java/com/dotcms/content/index/SearchAPIImpl.java
PhaseRouter: dotCMS/src/main/java/com/dotcms/content/index/PhaseRouter.java
OSSearchAPIImpl: dotCMS/src/main/java/com/dotcms/content/index/opensearch/OSSearchAPIImpl.java
- Phase config in tests:
MigrationPhaseTest.java — Config.setProperty(MigrationPhase.FLAG_KEY, ...)
- Document indexing pattern:
ContentletIndexOperationsOSIntegrationTest.java
Suggested class name
SearchAPIImplPhaseRoutingIT (requires both ES + OS containers, or a shared cluster with phase-switching)
Context
PR #35609 introduced
SearchAPIImpl(the phase-aware router) andOSSearchAPIImpl. The existingOSSearchAPIImplIntegrationTesttests the OS implementation directly against empty indices. The following coverage gaps were identified in the PR review and deferred to this issue.Missing test coverage
1. Phase routing selects the correct provider
ESSearchAPIImplis usedOSSearchAPIImplis usedSearchAPIImpl(notOSSearchAPIImpldirectly) and settingConfig.setProperty(MigrationPhase.FLAG_KEY, ...)per test, cleaning up in@After.2. ES fallback in Phase 2
OSSearchAPIImplthrows,PhaseRouter.readCheckedretries against ES.3.
searchRawpermission injection filters results for non-admin usersexecuteSearch()lines 263–300 inject a permission filter; today this is untested end-to-end against OS.Reference files
SearchAPIImpl:dotCMS/src/main/java/com/dotcms/content/index/SearchAPIImpl.javaPhaseRouter:dotCMS/src/main/java/com/dotcms/content/index/PhaseRouter.javaOSSearchAPIImpl:dotCMS/src/main/java/com/dotcms/content/index/opensearch/OSSearchAPIImpl.javaMigrationPhaseTest.java—Config.setProperty(MigrationPhase.FLAG_KEY, ...)ContentletIndexOperationsOSIntegrationTest.javaSuggested class name
SearchAPIImplPhaseRoutingIT(requires both ES + OS containers, or a shared cluster with phase-switching)