Skip to content

feat(search): move DocumentationDocument and friends into Elastic.Documentation#3553

Merged
Mpdreamz merged 2 commits into
mainfrom
feature/move-documentation-search-types-from-contract
Jun 25, 2026
Merged

feat(search): move DocumentationDocument and friends into Elastic.Documentation#3553
Mpdreamz merged 2 commits into
mainfrom
feature/move-documentation-search-types-from-contract

Conversation

@Mpdreamz

Copy link
Copy Markdown
Member

Summary

Moves DocumentationDocument, AppliesToEntry, IndexedProduct, and DocumentationMappingConfig (plus the extracted DocumentationMappingExtensions) from the Elastic.Internal.Search.Contract NuGet package into the Elastic.Documentation project under the Elastic.Documentation.Search namespace. These docs-builder-specific types belong to the docs producer, not the shared contract package.

  • Runtime polymorphism via SearchDocumentPolymorphism.Compose() (new in the companion contract PR):
    • Registers DocumentationDocument → "docs" on both ISearchDocument and SearchDocumentBase at startup.
    • Enables WithFallback() so missing/unknown $type deserializes to a concrete SearchDocumentBase instead of throwing NotSupportedException.
  • ElasticsearchClientJsonResolver is rewritten to use Compose(), composing the contract, Elasticsearch, and docs source-gen contexts.
  • Elastic.Mapping bumped to 0.48.0 to match the updated contract dependency.
  • Temporary ProjectReference to the local contract branch (TODO: switch back to PackageReference once published).

Depends on

website-search-data PR #215 — introduces SearchDocumentPolymorphism and removes DocumentationDocument from the contract package. Switch the ProjectReference back to a PackageReference before merging this PR (after PR #215 is published).

Test plan

  • dotnet build — 0 errors, 1 pre-existing vulnerability warning
  • dotnet-lint pre-push hook — passes (no formatting violations)
  • dotnet test tests/Elastic.Documentation.Build.Tests/ — 44 tests, all green
  • Integration tests (tests-integration/) compile cleanly; runtime requires ES connection

🤖 Generated with Claude Code

@Mpdreamz Mpdreamz requested a review from a team as a code owner June 22, 2026 12:14
@Mpdreamz Mpdreamz requested a review from theletterf June 22, 2026 12:14
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 8484610f-6bec-4278-a065-a345e94a8135

📥 Commits

Reviewing files that changed from the base of the PR and between 0a6c880 and cca988a.

📒 Files selected for processing (18)
  • Directory.Packages.props
  • src/Elastic.Documentation/AppliesTo/ApplicableTo.cs
  • src/Elastic.Documentation/Elastic.Documentation.csproj
  • src/Elastic.Documentation/Search/AppliesToEntry.cs
  • src/Elastic.Documentation/Search/DocumentationDocument.cs
  • src/Elastic.Documentation/Search/DocumentationMappingConfig.cs
  • src/Elastic.Documentation/Search/DocumentationMappingExtensions.cs
  • src/Elastic.Documentation/Search/IndexedProduct.cs
  • src/Elastic.Documentation/Serialization/SourceGenerationContext.cs
  • src/Elastic.Markdown/Exporters/Elasticsearch/ElasticsearchMarkdownExporter.cs
  • src/api/Elastic.Documentation.Mcp.Remote/Gateways/DocumentGateway.cs
  • src/services/Elastic.Documentation.Assembler/Building/AssemblerSitemapService.cs
  • src/services/search/Elastic.Documentation.Search/ChangesService.cs
  • src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs
  • src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientJsonResolver.cs
  • tests-integration/Elastic.Documentation.IntegrationTests/Search/SearchBootstrapFixture.cs
  • tests-integration/Mcp.Remote.IntegrationTests/McpToolsIntegrationTestsBase.cs
  • tests-integration/Search.IntegrationTests/SearchRelevanceTests.cs
💤 Files with no reviewable changes (3)
  • src/api/Elastic.Documentation.Mcp.Remote/Gateways/DocumentGateway.cs
  • src/services/Elastic.Documentation.Assembler/Building/AssemblerSitemapService.cs
  • src/Elastic.Documentation/AppliesTo/ApplicableTo.cs
✅ Files skipped from review due to trivial changes (3)
  • tests-integration/Elastic.Documentation.IntegrationTests/Search/SearchBootstrapFixture.cs
  • src/services/search/Elastic.Documentation.Search/ChangesService.cs
  • src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/Elastic.Documentation/Search/AppliesToEntry.cs
  • src/Elastic.Documentation/Serialization/SourceGenerationContext.cs
  • src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientJsonResolver.cs
  • src/Elastic.Documentation/Search/DocumentationMappingConfig.cs
  • tests-integration/Mcp.Remote.IntegrationTests/McpToolsIntegrationTestsBase.cs
  • src/Elastic.Documentation/Search/IndexedProduct.cs
  • tests-integration/Search.IntegrationTests/SearchRelevanceTests.cs
  • src/Elastic.Documentation/Search/DocumentationDocument.cs
  • src/Elastic.Documentation/Search/DocumentationMappingExtensions.cs

📝 Walkthrough

Walkthrough

Adds local documentation search records (AppliesToEntry, IndexedProduct, DocumentationDocument), Elasticsearch mapping and JSON source-generation wiring for those types, and a resolver that registers DocumentationDocument under the docs discriminator. Updates services, gateways, integration tests, and central package references to use the local Elastic.Documentation.Search types and Elastic.Mapping.

Possibly related PRs

  • elastic/docs-builder#3550: Changes the same ElasticsearchClientJsonResolver path for docs-search JSON composition and DocumentationDocument registration.
  • elastic/docs-builder#3462: Also updates ElasticsearchClientJsonResolver.Create() and the source-generated resolver composition used for search documents.
  • elastic/docs-builder#3455: Updates the same central package versions in Directory.Packages.props.

Suggested labels

enhancement

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/move-documentation-search-types-from-contract
  • 🛠️ Update Documentation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Elastic.Documentation/Elastic.Documentation.csproj`:
- Around line 14-15: The ProjectReference for Elastic.Internal.Search.Contract
in the Elastic.Documentation.csproj file uses a hardcoded workspace-specific
external path (../../../../.supacode/repos/...) that will not work in other
environments. As indicated by the TODO comment, replace this ProjectReference
with a PackageReference to the contract package instead, or if the package
version is not yet published, restructure the reference to use a repo-local path
that does not depend on external workspace layouts. Remove the external path
dependency to ensure the project can be restored and built in any environment.

In
`@src/services/search/Elastic.Documentation.Search/Elastic.Documentation.Search.csproj`:
- Around line 19-20: The ProjectReference pointing to the hardcoded
`.supacode/repos/website-search-data/...` path in the
Elastic.Documentation.Search.csproj file creates a portability issue by forcing
a specific directory layout dependency. Replace this ProjectReference to
Elastic.Internal.Search.Contract.csproj with a PackageReference to the
Elastic.Internal.Search.Contract NuGet package once it is published, or if it is
already published, use the PackageReference immediately instead of the
path-based ProjectReference to ensure the project can be restored and built in
any environment without requiring a specific sibling checkout structure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0f3ddfc4-85a4-4bba-a979-88bca5bcbe19

📥 Commits

Reviewing files that changed from the base of the PR and between b50d550 and 9592958.

📒 Files selected for processing (18)
  • Directory.Packages.props
  • src/Elastic.Documentation/AppliesTo/ApplicableTo.cs
  • src/Elastic.Documentation/Elastic.Documentation.csproj
  • src/Elastic.Documentation/Search/AppliesToEntry.cs
  • src/Elastic.Documentation/Search/DocumentationDocument.cs
  • src/Elastic.Documentation/Search/DocumentationMappingConfig.cs
  • src/Elastic.Documentation/Search/DocumentationMappingExtensions.cs
  • src/Elastic.Documentation/Search/IndexedProduct.cs
  • src/Elastic.Documentation/Serialization/SourceGenerationContext.cs
  • src/api/Elastic.Documentation.Mcp.Remote/Gateways/DocumentGateway.cs
  • src/services/Elastic.Documentation.Assembler/Building/AssemblerSitemapService.cs
  • src/services/search/Elastic.Documentation.Search/ChangesService.cs
  • src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs
  • src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientJsonResolver.cs
  • src/services/search/Elastic.Documentation.Search/Elastic.Documentation.Search.csproj
  • tests-integration/Elastic.Documentation.IntegrationTests/Search/SearchBootstrapFixture.cs
  • tests-integration/Mcp.Remote.IntegrationTests/McpToolsIntegrationTestsBase.cs
  • tests-integration/Search.IntegrationTests/SearchRelevanceTests.cs
💤 Files with no reviewable changes (3)
  • src/services/Elastic.Documentation.Assembler/Building/AssemblerSitemapService.cs
  • src/api/Elastic.Documentation.Mcp.Remote/Gateways/DocumentGateway.cs
  • src/Elastic.Documentation/AppliesTo/ApplicableTo.cs

Comment thread src/Elastic.Documentation/Elastic.Documentation.csproj Outdated
@Mpdreamz Mpdreamz force-pushed the feature/move-documentation-search-types-from-contract branch from 9592958 to 0a6c880 Compare June 23, 2026 10:52
@Mpdreamz Mpdreamz had a problem deploying to integration-tests June 23, 2026 10:52 — with GitHub Actions Failure
Mpdreamz and others added 2 commits June 25, 2026 15:56
…umentation

Move DocumentationDocument, AppliesToEntry, IndexedProduct, and
DocumentationMappingConfig (+ DocumentationMappingExtensions) from the
Elastic.Internal.Search.Contract NuGet package into the Elastic.Documentation
project under the Elastic.Documentation.Search namespace. These types
belong to the docs producer, not the shared contract.

Wire up runtime polymorphism via SearchDocumentPolymorphism.Compose():
- Register DocumentationDocument as a "docs" derived type on both
  ISearchDocument and SearchDocumentBase at startup in
  ElasticsearchClientJsonResolver.
- Enable WithFallback() so missing/unknown $type deserializes to a concrete
  SearchDocumentBase instead of throwing NotSupportedException.

Bump Elastic.Mapping to 0.48.0 to match the updated contract dependency.
Use a temporary ProjectReference to the local contract branch until the new
package version is published.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ageReference 0.11.0

The temporary local ProjectReference (pointing at a supacode workspace path)
broke CI. Replace with the now-published NuGet package and remove the unused
`using Elastic.Internal.Search` that caused an ambiguous SourceGenerationContext
reference after the contract package gained its own.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Mpdreamz Mpdreamz force-pushed the feature/move-documentation-search-types-from-contract branch from 0a6c880 to cca988a Compare June 25, 2026 14:03
@Mpdreamz Mpdreamz temporarily deployed to integration-tests June 25, 2026 14:03 — with GitHub Actions Inactive
@Mpdreamz Mpdreamz merged commit 9eb80c9 into main Jun 25, 2026
25 checks passed
@Mpdreamz Mpdreamz deleted the feature/move-documentation-search-types-from-contract branch June 25, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants