Skip to content

Commit a979eea

Browse files
Support new attributes (#227)
1 parent fa64ef1 commit a979eea

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/Typesense/Field.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public record Field
2121
[JsonPropertyName("index")]
2222
public bool? Index { get; init; }
2323

24+
[JsonPropertyName("store")]
25+
public bool? Store { get; init; }
26+
2427
[JsonPropertyName("sort")]
2528
public bool? Sort { get; init; }
2629

src/Typesense/SearchResult.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,17 @@ public record Hit<T>
6363
[JsonPropertyName("vector_distance")]
6464
public double? VectorDistance { get; init; }
6565

66+
[JsonPropertyName("geo_distance_meters")]
67+
public IReadOnlyDictionary<string, int>? GeoDistanceMeters { get; init; }
68+
6669
[JsonConstructor]
67-
public Hit(IReadOnlyList<Highlight> highlights, T document, long? textMatch, double? vectorDistance)
70+
public Hit(IReadOnlyList<Highlight> highlights, T document, long? textMatch, double? vectorDistance, IReadOnlyDictionary<string, int>? geoDistanceMeters)
6871
{
6972
Highlights = highlights;
7073
Document = document;
7174
TextMatch = textMatch;
7275
VectorDistance = vectorDistance;
76+
GeoDistanceMeters = geoDistanceMeters;
7377
}
7478
}
7579

test/Typesense.Tests/TypesenseClientTests.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,8 @@ await _client.CreateDocument(
17061706
Vec = new float[] { 0.04F, 0.234F, 0.113F, 0.001F }
17071707
},
17081708
null,
1709-
0.19744956493377686));
1709+
0.19744956493377686,
1710+
null));
17101711

17111712
queryStringResponse.Found.Should().Be(1);
17121713
queryStringResponse.OutOf.Should().Be(1);
@@ -1724,7 +1725,8 @@ await _client.CreateDocument(
17241725
Vec = new float[] { 0.04F, 0.234F, 0.113F, 0.001F }
17251726
},
17261727
null,
1727-
0.19744956493377686));
1728+
0.19744956493377686,
1729+
null));
17281730
}
17291731
}
17301732
finally
@@ -1867,7 +1869,8 @@ await _client.CreateDocument(
18671869
Title = "Introduction to Programming",
18681870
},
18691871
null,
1870-
0.4871443510055542));
1872+
0.4871443510055542,
1873+
null));
18711874
}
18721875
}
18731876
finally

0 commit comments

Comments
 (0)