Skip to content

Conversation

reakaleek
Copy link
Member

@reakaleek reakaleek commented Oct 6, 2025

Part of https://github.com/elastic/docs-eng-team/issues/266
Closes https://github.com/elastic/docs-eng-team/issues/181
Closes https://github.com/elastic/docs-eng-team/issues/196
Closes https://github.com/elastic/docs-eng-team/issues/195

Changes

  • Use Elasticsearch's highlighting feature instead of EUI highlighting
  • Add highlighted body to search results
  • Simplify design:
    • Use bold instead of yellow highlighting.
    • Don't highlight title and breadcrumbs
  • Fix pagination

Screenshot

image

@reakaleek reakaleek changed the title Elasticsearch highlighting Add highlighted body text to search results Oct 6, 2025
@reakaleek reakaleek self-assigned this Oct 6, 2025
@reakaleek reakaleek marked this pull request as ready for review October 6, 2025 22:16
@reakaleek reakaleek requested a review from a team as a code owner October 6, 2025 22:16
@reakaleek reakaleek requested review from Mpdreamz and Copilot October 6, 2025 22:16
Copy link
Contributor

@Copilot 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

This PR implements search result highlighting by switching from client-side EUI highlighting to server-side Elasticsearch highlighting. It adds highlighted body text snippets to search results and simplifies the design to use bold formatting instead of yellow highlighting.

Key changes:

  • Replaced EUI client-side highlighting with Elasticsearch server-side highlighting
  • Added body text highlighting with configurable fragment settings
  • Updated search result display to show highlighted body snippets

Reviewed Changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/api/Elastic.Documentation.Api.Infrastructure/Elastic.Documentation.Api.Infrastructure.csproj Added project reference to Elastic.Documentation.csproj
src/api/Elastic.Documentation.Api.Infrastructure/Aws/LocalParameterProvider.cs Updated environment variable handling with default values
src/api/Elastic.Documentation.Api.Infrastructure/Adapters/Search/ElasticsearchGateway.cs Implemented Elasticsearch highlighting and added stripped_body field support
src/api/Elastic.Documentation.Api.Core/Search/SearchUsecase.cs Added HighlightedBody property to SearchResultItem
src/Elastic.Markdown/Exporters/IMarkdownExporter.cs Removed unused LLMText property
src/Elastic.Markdown/Exporters/ElasticsearchMarkdownExporter.cs Added stripped_body field and highlight analyzer configuration
src/Elastic.Documentation/Search/DocumentationDocument.cs Added StrippedBody property to document model
src/Elastic.Documentation.Site/package.json Added dompurify dependency for HTML sanitization
src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/SearchOrAskAiModal.tsx Reduced modal max-height from 80vh to 70vh
src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/Search/useSearchQuery.ts Added highlightedBody field to TypeScript type definition
src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/Search/SearchResults.tsx Replaced EUI highlighting with server-side highlighted content display
Files not reviewed (1)
  • src/Elastic.Documentation.Site/package-lock.json: Language not supported

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

LGTM maybe it can follow our inline code styling?

https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/2011/syntax/code#inline-code

That way we can have the highlighter just emit code and we don't have to the unsafe html innertext.

@reakaleek
Copy link
Member Author

reakaleek commented Oct 7, 2025

LGTM maybe it can follow our inline code styling?

https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/2011/syntax/code#inline-code

That way we can have the highlighter just emit code and we don't have to the unsafe html innertext.

Can you elaborate? I don't understand the connection between inline code styling and unsafe html.

Nevertheless, happy to follow-up.

@reakaleek reakaleek merged commit 293a943 into main Oct 7, 2025
30 of 31 checks passed
@reakaleek reakaleek deleted the feature/search-highlighting branch October 7, 2025 15:06
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