Skip to content

Commit

Permalink
implements found docs (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
runeanielsen authored Jan 25, 2024
1 parent cc14be9 commit 050128d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Typesense/SearchResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ public abstract record SearchResultBase
[JsonPropertyName("found")]
public int Found { get; init; }

[JsonPropertyName("found_docs")]
public int? FoundDocs { get; init; }

[JsonPropertyName("out_of")]
public int OutOf { get; init; }

Expand All @@ -189,14 +192,16 @@ protected SearchResultBase(
int outOf,
int page,
int searchTimeMs,
int? tookMs)
int? tookMs,
int? foundDocs = null)
{
FacetCounts = facetCounts;
Found = found;
OutOf = outOf;
Page = page;
SearchTimeMs = searchTimeMs;
TookMs = tookMs;
FoundDocs = foundDocs;
}
}

Expand Down
2 changes: 2 additions & 0 deletions test/Typesense.Tests/TypesenseClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,8 @@ public async Task Search_grouped_by_country()

using (var scope = new AssertionScope())
{
response.Found.Should().Be(1);
response.FoundDocs.Value.Should().Be(1);
response.GroupedHits.Should().NotBeEmpty();
var firstHit = response.GroupedHits.First();
firstHit.GroupKey.Should().BeEquivalentTo("USA");
Expand Down

0 comments on commit 050128d

Please sign in to comment.