Skip to content

task(34647) ContentletFactory migration to OS - #34691

Merged
fabrizzio-dotCMS merged 25 commits into
mainfrom
issue-34647-ContentletFactory-OS-Migration
Feb 25, 2026
Merged

fabrizzio-dotCMS merged 25 commits into
mainfrom
issue-34647-ContentletFactory-OS-Migration

Conversation

@fabrizzio-dotCMS

@fabrizzio-dotCMS fabrizzio-dotCMS commented Feb 18, 2026 •

Copy link
Copy Markdown
Member

Proposed Changes


🔧 Refactor: Separate Index Operations and Add OpenSearch Migration Foundation

Summary

This PR introduces a major architectural refactoring to separate index operations from the main content factory implementation and establishes the foundation for OpenSearch migration. This represents the beginning of a clean separation
of concerns between content management and search engine operations.

🚀 Key Changes

  1. Index Operations Extraction & Abstraction
  • Extracted index operations from ESContentFactoryImpl into dedicated, specialized classes
  • Created ContentFactoryIndexOperations interface - pure contract for search engine agnostic operations
  • Implemented ContentFactoryIndexOperationsES - Elasticsearch-specific implementation
  • Implemented ContentFactoryIndexOperationsOS - OpenSearch-specific implementation (partial)
  1. Search Engine Agnostic Domain Objects
  • Created immutable domain objects to eliminate direct library dependencies:
    • SearchHit - unified representation of individual search results
    • SearchHits - collection of search results with metadata
    • TotalHits - search count information with relation metadata
    • Relation - enum for count precision (exact vs estimate)
  • Factory methods for seamless conversion between Elasticsearch/OpenSearch types and domain objects
  • JSON serialization support for REST APIs and caching
  1. Migration Documentation & Analysis Annotations
  • @IndexMetadata - Documents current migration state and index interaction patterns
  • @IndexLibraryIndependent - Enforces architectural purity for search engine agnostic APIs
  • ArchUnit tests to prevent library-specific dependencies in abstraction layers
  1. Improved Code Quality
  • Comprehensive JavaDoc documentation with usage examples and architectural explanations
  • @inheritdoc annotations for implementation classes to maintain documentation consistency
  • Type-safe immutable objects using Immutables library

🔄 Architecture Benefits

Before:

ESContentFactoryImpl ──> Elasticsearch APIs (tightly coupled)

After:

ContentFactory ──> ContentFactoryIndexOperations (interface)
├── ContentFactoryIndexOperationsES
└── ContentFactoryIndexOperationsOS

⚠️ Current Limitations (OpenSearch Implementation)

Incomplete Features:

  • Scroll API implementation - Currently throws UnsupportedOperationException
  • Missing test coverage for OpenSearch implementation
  • Basic indexSearchScroll() - Uses simple pagination instead of true scroll functionality

Planned Next Steps:

  1. Complete OpenSearch Scroll API implementation
  2. Add comprehensive integration tests for OpenSearch operations
  3. Implement dynamic selection mechanism between ES/OS implementations
  4. Performance benchmarking and optimization

🏗️ Architectural Impact

Separation of Concerns:

  • Content operations remain in content factory classes
  • Search operations isolated in specialized index operation classes
  • Domain objects provide clean abstraction without vendor lock-in

Future Migration Benefits:

  • Zero-downtime migration capability between search engines
  • A/B testing different search engine implementations
  • Unified API surface regardless of underlying search technology

📋 Testing Status

  • ✅ Elasticsearch operations - Fully functional with existing test coverage
  • ⚠️ OpenSearch operations - Basic functionality implemented, tests needed
  • ✅ Domain object conversions - Factory methods tested
  • ✅ ArchUnit rules - Architectural constraints enforced

⚠️ Note: This is a foundational PR. OpenSearch implementation requires additional work for production readiness, particularly Scroll API functionality and comprehensive testing.

This PR fixes: #34647

This PR fixes: #34647

@github-actions github-actions Bot added the Area : Backend PR changes Java/Maven backend code label Feb 18, 2026
@fabrizzio-dotCMS
fabrizzio-dotCMS marked this pull request as ready for review February 21, 2026 02:47
@fabrizzio-dotCMS
fabrizzio-dotCMS added this pull request to the merge queue Feb 25, 2026
Merged via the queue into main with commit 52ceaed Feb 25, 2026
39 checks passed
@fabrizzio-dotCMS
fabrizzio-dotCMS deleted the issue-34647-ContentletFactory-OS-Migration branch February 25, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[TASK] Migrate ESContentFactoryImpl

4 participants