Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private static string EncodeCursor(ChangesPageCursor cursor)
var buffer = new ArrayBufferWriter<byte>();
using var writer = new Utf8JsonWriter(buffer);
writer.WriteStartArray();
writer.WriteNumberValue(cursor.LastUpdatedEpochMs);
writer.WriteNumberValue(cursor.ContentLastUpdatedEpochMs);
writer.WriteStringValue(cursor.Url);
writer.WriteEndArray();
writer.Flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public record ChangesResult
}

/// <summary>Cursor for search_after pagination over changed pages.</summary>
public record ChangesPageCursor(long LastUpdatedEpochMs, string Url);
public record ChangesPageCursor(long ContentLastUpdatedEpochMs, string Url);

/// <summary>Shared defaults for the changes feed.</summary>
public static class ChangesDefaults
Expand Down
12 changes: 6 additions & 6 deletions src/services/Elastic.Documentation.Search/ChangesGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Elastic.Documentation.Search;

/// <summary>
/// Elasticsearch gateway for the documentation changes feed.
/// Queries last_updated > since with search_after cursor pagination.
/// Queries content_last_updated > since with search_after cursor pagination.
/// Uses a shared Point In Time (PIT) for consistent pagination across requests.
/// </summary>
public partial class ChangesGateway(
Expand Down Expand Up @@ -67,12 +67,12 @@ await clientAccessor.Client.SearchAsync<DocumentationDocument>(s =>
.Pit(p => p.Id(pitId).KeepAlive(SharedPointInTimeManager.PitKeepAlive))
.Query(q => q.Range(r => r
.Date(dr => dr
.Field(f => f.LastUpdated)
.Field(f => f.ContentLastUpdated)
.Gt(request.Since.ToString("O"))
)
))
.Sort(
so => so.Field(f => f.LastUpdated, sf => sf.Order(SortOrder.Asc)),
so => so.Field(f => f.ContentLastUpdated, sf => sf.Order(SortOrder.Asc)),
so => so.Field(f => f.Url, sf => sf.Order(SortOrder.Asc))
)
.Source(sf => sf
Expand All @@ -82,15 +82,15 @@ await clientAccessor.Client.SearchAsync<DocumentationDocument>(s =>
e => e.Title,
e => e.SearchTitle,
e => e.Type,
e => e.LastUpdated
e => e.ContentLastUpdated
)
)
);

if (request.Cursor is { } cursor)
{
_ = s.SearchAfter(
FieldValue.Long(cursor.LastUpdatedEpochMs),
FieldValue.Long(cursor.ContentLastUpdatedEpochMs),
FieldValue.String(cursor.Url)
);
}
Expand All @@ -116,7 +116,7 @@ private static ChangesResult BuildResult(SearchResponse<DocumentationDocument> r
{
Url = doc.Url,
Title = doc.Title,
LastUpdated = doc.LastUpdated
LastUpdated = doc.ContentLastUpdated
};
})
.ToList();
Expand Down
Loading