Skip to content

Commit c6f9411

Browse files
authored
Merge branch 'main' into docs/stack-next-9.4-post-ff
2 parents d36b47a + 78603a9 commit c6f9411

30 files changed

Lines changed: 662 additions & 60 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ jobs:
117117

118118
release:
119119
needs:
120-
- containers
121120
- release-drafter
122121
strategy:
123122
fail-fast: false
@@ -167,6 +166,7 @@ jobs:
167166
publish-release:
168167
needs:
169168
- release
169+
- containers
170170
- release-drafter
171171
- deploy-link-index-updater-lambda-prod
172172
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
55

66
.artifacts
7+
.superset
78
.claude/*
89
!.claude/settings.json
910
!.claude/skills/

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949
<PackageVersion Include="Elastic.Aspire.Hosting.Elasticsearch" Version="9.3.0" />
5050
<PackageVersion Include="Elastic.Clients.Elasticsearch" Version="9.3.4" />
5151
<PackageVersion Include="FakeItEasy" Version="9.0.1" />
52-
<PackageVersion Include="Elastic.Ingest.Elasticsearch" Version="0.40.0" />
52+
<PackageVersion Include="Elastic.Ingest.Elasticsearch" Version="0.41.0" />
5353
<PackageVersion Include="Elastic.Mapping" Version="0.41.0" />
5454
<PackageVersion Include="InMemoryLogger" Version="1.0.66" />
55-
<PackageVersion Include="MartinCostello.Logging.XUnit.v3" Version="0.7.0" />
55+
<PackageVersion Include="MartinCostello.Logging.XUnit.v3" Version="0.7.1" />
5656
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.3" />
5757
<PackageVersion Include="Microsoft.OpenApi" Version="3.1.1" />
5858
<PackageVersion Include="TUnit" Version="0.25.21" />

config/versions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ versioning_systems:
9797
current: 1.3.1
9898
edot-python:
9999
base: 1.0
100-
current: 1.11.0
100+
current: 1.12.0
101101
edot-cf-aws:
102102
base: 1.0
103103
current: 1.5.0
@@ -106,7 +106,7 @@ versioning_systems:
106106
current: 0.7.1
107107
edot-cf-gcp:
108108
base: 0.1
109-
current: 0.1.2
109+
current: 0.1.3
110110
terraform-google-edot-cf:
111111
base: 0.1
112112
current: 0.1.2

src/Elastic.Documentation.Configuration/Search/SearchConfiguration.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@ namespace Elastic.Documentation.Configuration.Search;
99

1010
public record SearchConfiguration
1111
{
12-
private readonly IReadOnlyDictionary<string, string[]> _synonyms;
12+
private readonly IReadOnlyList<string[]> _synonyms;
1313

14-
public required IReadOnlyDictionary<string, string[]> Synonyms
14+
public required IReadOnlyList<string[]> Synonyms
1515
{
1616
get => _synonyms;
1717
[MemberNotNull(nameof(_synonyms))]
1818
init
1919
{
2020
_synonyms = value;
2121
SynonymBiDirectional = value
22-
.Select(kv => kv.Value.Concat([kv.Key]).ToArray())
2322
.SelectMany(a =>
2423
{
2524
var targets = new List<string[]>();
@@ -120,15 +119,17 @@ public static class SearchConfigurationExtensions
120119
public static SearchConfiguration CreateSearchConfiguration(this ConfigurationFileProvider provider)
121120
{
122121
var searchFile = provider.SearchFile;
123-
var synonyms = new Dictionary<string, string[]>();
124122

125123
if (!searchFile.Exists)
126-
return new SearchConfiguration { Synonyms = synonyms, Rules = [], DiminishTerms = [] };
124+
return new SearchConfiguration { Synonyms = [], Rules = [], DiminishTerms = [] };
127125

128126
var searchDto = ConfigurationFileProvider.Deserializer.Deserialize<SearchConfigDto>(searchFile.OpenText());
129-
synonyms = searchDto.Synonyms
127+
var synonyms = searchDto.Synonyms
130128
.Where(s => s.Count > 1)
131-
.ToDictionary(k => k[0], sl => sl.Skip(1).ToArray(), StringComparer.OrdinalIgnoreCase);
129+
.Select(s => s.ToArray())
130+
.GroupBy(s => s[0], StringComparer.OrdinalIgnoreCase)
131+
.Select(g => g.First())
132+
.ToArray();
132133
var rules = searchDto.Rules.Select(ParseRule).ToImmutableArray();
133134
var diminishTerms = searchDto.DiminishTerms.ToImmutableArray();
134135
return new SearchConfiguration { Synonyms = synonyms, Rules = rules, DiminishTerms = diminishTerms };

src/Elastic.Documentation/Search/ContentHash.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,27 @@
44

55
using System.Security.Cryptography;
66
using System.Text;
7+
using System.Text.RegularExpressions;
78

89
namespace Elastic.Documentation.Search;
910

1011
/// <summary>Creates a short hex hash from one or more string components.</summary>
11-
public static class ContentHash
12+
public static partial class ContentHash
1213
{
1314
/// <summary>
1415
/// Concatenates all components, computes SHA-256, and returns the first 16 hex characters (lowercased).
1516
/// Compatible with <c>HashedBulkUpdate.CreateHash</c>.
1617
/// </summary>
1718
public static string Create(params string[] components) =>
1819
Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(string.Join("", components))))[..16].ToLowerInvariant();
20+
21+
/// <summary>
22+
/// Collapses all whitespace runs to a single space, trims, then hashes.
23+
/// Ensures that whitespace-only changes do not produce a different hash.
24+
/// </summary>
25+
public static string CreateNormalized(string content) =>
26+
Create(WhitespaceRuns().Replace(content.Trim(), " "));
27+
28+
[GeneratedRegex(@"\s+")]
29+
private static partial Regex WhitespaceRuns();
1930
}

src/Elastic.Documentation/Search/DocumentationDocument.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ public record DocumentationDocument
8484
[JsonPropertyName("last_updated")]
8585
public DateTimeOffset LastUpdated { get; set; }
8686

87+
/// The date this document's content (stripped_body) was last updated.
88+
/// Only advances when the whitespace-normalized content hash changes.
89+
[JsonPropertyName("content_last_updated")]
90+
public DateTimeOffset ContentLastUpdated { get; set; }
91+
92+
/// A hash of the whitespace-normalized stripped_body, used to detect content-only changes.
93+
[Keyword]
94+
[JsonPropertyName("content_hash")]
95+
public string ContentBodyHash { get; set; } = string.Empty;
96+
8797
[JsonPropertyName("description")]
8898
public string? Description { get; set; }
8999

src/Elastic.Documentation/Search/DocumentationMappingConfig.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,17 @@ internal static MappingsBuilder<DocumentationDocument> ConfigureCommonMappings(M
6363
.Headings(f => f
6464
.Analyzer("synonyms_fixed_analyzer")
6565
.SearchAnalyzer("synonyms_analyzer"))
66-
// AI field with custom analyzers not on the attribute
66+
// AI fields with custom analyzers not on the attribute
6767
.AddField("ai_rag_optimized_summary", f => f.Text()
6868
.Analyzer("synonyms_fixed_analyzer")
6969
.SearchAnalyzer("synonyms_analyzer"))
70+
.AddField("ai_questions", f => f.Text()
71+
.Analyzer("synonyms_fixed_analyzer")
72+
.SearchAnalyzer("synonyms_analyzer")
73+
.MultiField("completion", mf => mf.SearchAsYouType()
74+
.Analyzer("synonyms_fixed_analyzer")
75+
.SearchAnalyzer("synonyms_analyzer")
76+
.IndexOptions("offsets")))
7077
// Keyword fields with multi-fields
7178
.Url(f => f
7279
.MultiField("match", mf => mf.Text())

0 commit comments

Comments
 (0)