-
Notifications
You must be signed in to change notification settings - Fork 30
Add highlighted body text to search results #2008
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
Conversation
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 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
src/Elastic.Markdown/Exporters/ElasticsearchMarkdownExporter.cs
Outdated
Show resolved
Hide resolved
src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/Search/SearchResults.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
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. |
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
Screenshot