Skip to content

Commit cfe9ed6

Browse files
committed
updating 8.4 state
1 parent d48818b commit cfe9ed6

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed

src/NRedisStack/PublicAPI/PublicAPI.Unshipped.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,5 @@ static NRedisStack.Search.Parameters.From<T>(T obj) -> System.Collections.Generi
9090
[NRS001]static NRedisStack.Search.VectorData.implicit operator NRedisStack.Search.VectorData!(System.ReadOnlyMemory<float> vector) -> NRedisStack.Search.VectorData!
9191
[NRS001]static NRedisStack.Search.VectorData.Parameter(string! name) -> NRedisStack.Search.VectorData!
9292
[NRS001]static NRedisStack.Search.VectorData.Raw(System.ReadOnlyMemory<byte> bytes) -> NRedisStack.Search.VectorData!
93-
[NRS001]static NRedisStack.Search.VectorSearchMethod.NearestNeighbour(int count = 10, int? maxTopCandidates = null, string? distanceAlias = null) -> NRedisStack.Search.VectorSearchMethod!
94-
[NRS001]static NRedisStack.Search.VectorSearchMethod.Range(double radius, double? epsilon = null, string? distanceAlias = null) -> NRedisStack.Search.VectorSearchMethod!
93+
[NRS001]static NRedisStack.Search.VectorSearchMethod.NearestNeighbour(int count = 10) -> NRedisStack.Search.VectorSearchMethod!
94+
[NRS001]static NRedisStack.Search.VectorSearchMethod.Range(double radius) -> NRedisStack.Search.VectorSearchMethod!

src/NRedisStack/Search/VectorSearchMethod.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ private protected VectorSearchMethod()
1717
/// <inheritdoc />
1818
public override string ToString() => Method;
1919

20-
public static VectorSearchMethod Range(double radius, double? epsilon = null, string? distanceAlias = null)
20+
public static VectorSearchMethod Range(double radius) => RangeVectorSearchMethod.Create(radius, null, null);
21+
internal static VectorSearchMethod Range(double radius, double? epsilon, string? distanceAlias = null)
2122
=> RangeVectorSearchMethod.Create(radius, epsilon, distanceAlias);
2223

2324
public static VectorSearchMethod NearestNeighbour(
24-
int count = NearestNeighbourVectorSearchMethod.DEFAULT_NEAREST_NEIGHBOUR_COUNT, int? maxTopCandidates = null,
25-
string? distanceAlias = null)
26-
=> NearestNeighbourVectorSearchMethod.Create(count, maxTopCandidates, distanceAlias);
25+
int count = NearestNeighbourVectorSearchMethod.DEFAULT_NEAREST_NEIGHBOUR_COUNT)
26+
=> NearestNeighbourVectorSearchMethod.Create(count, null, null);
27+
28+
internal static VectorSearchMethod NearestNeighbour(
29+
int? count, int? maxTopCandidates, string? distanceAlias = null)
30+
=> NearestNeighbourVectorSearchMethod.Create(count ?? NearestNeighbourVectorSearchMethod.DEFAULT_NEAREST_NEIGHBOUR_COUNT, maxTopCandidates, distanceAlias);
2731

2832
private sealed class NearestNeighbourVectorSearchMethod : VectorSearchMethod
2933
{

tests/NRedisStack.Tests/Search/HybridSearchIntegrationTests.cs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System.Buffers;
2-
using System.Data;
3-
using System.Numerics;
42
using System.Reflection;
53
using System.Runtime.CompilerServices;
64
using System.Runtime.InteropServices;
@@ -49,7 +47,7 @@ private async Task<Api> CreateIndexAsync(string endpointId, [CallerMemberName] s
4947

5048
var ftCreateParams = FTCreateParams.CreateParams();
5149
Assert.True(await ft.CreateAsync(index, ftCreateParams, sc));
52-
50+
5351
if (populate)
5452
{
5553
#if NET
@@ -77,7 +75,7 @@ private async Task<Api> CreateIndexAsync(string endpointId, [CallerMemberName] s
7775

7876
await last;
7977
#else
80-
throw new PlatformNotSupportedException("FP16");
78+
throw new SkipException("FP16 not supported");
8179
#endif
8280
}
8381

@@ -138,13 +136,9 @@ public enum Scenario
138136
{
139137
Simple,
140138
NoSort,
141-
ExplainScore,
142139
Apply,
143140
LinearNoScore,
144-
LinearWithScore,
145141
RrfNoScore,
146-
RrfWithScore,
147-
PostFilterByTag,
148142
PostFilterByNumber,
149143
LimitFirstPage,
150144
LimitSecondPage,
@@ -159,36 +153,41 @@ public enum Scenario
159153
GroupByNoReduce,
160154
SearchWithAlias,
161155
SearchWithSimpleScorer,
162-
SearchWithComplexScorer,
163156
VectorWithAlias,
164157
VectorWithRange,
165-
VectorWithRangeAndDistanceAlias,
166-
VectorWithRangeAndEpsilon,
167158
VectorWithTagFilter,
168159
VectorWithNumericFilter,
169160
VectorWithNearest,
170161
VectorWithNearestCount,
171-
VectorWithNearestDistAlias,
172-
VectorWithNearestMaxCandidates,
173162
PreFilterByTag,
174163
PreFilterByNumeric,
175-
ParamPostFilter,
176164
ParamSearch,
177165
ParamVsim,
178-
ParamMultiPostFilter,
179166
ParamPreFilter,
180-
ParamMultiPreFilter
167+
ParamMultiPreFilter,
168+
169+
[NotYetImplemented] ExplainScore,
170+
[NotYetImplemented] LinearWithScore,
171+
[NotYetImplemented] RrfWithScore,
172+
[NotYetImplemented] PostFilterByTag,
173+
[NotYetImplemented] SearchWithComplexScorer,
174+
[NotYetImplemented] VectorWithRangeAndDistanceAlias,
175+
[NotYetImplemented] VectorWithRangeAndEpsilon,
176+
[NotYetImplemented] VectorWithNearestDistAlias,
177+
[NotYetImplemented] VectorWithNearestMaxCandidates,
178+
[NotYetImplemented] ParamPostFilter,
179+
[NotYetImplemented] ParamMultiPostFilter,
181180
}
182181

183-
private sealed class BrokenAttribute : Attribute
182+
private sealed class NotYetImplementedAttribute : Attribute
184183
{
185184
}
186185

187186
private static class EnumCache<T>
188187
{
189188
public static IEnumerable<T> Values { get; } = (
190189
from field in typeof(T).GetFields(BindingFlags.Public | BindingFlags.Static)
191-
where !Attribute.IsDefined(field, typeof(BrokenAttribute))
190+
where !Attribute.IsDefined(field, typeof(NotYetImplementedAttribute))
192191
let val = field.GetRawConstantValue()
193192
where val is not null
194193
select (T)val).ToArray();
@@ -236,17 +235,17 @@ public async Task TestSearchScenarios(string endpointId, Scenario scenario)
236235
Scenario.VectorWithRange => query.VectorSearch(new("@vector1", VectorData.Raw(vec),
237236
method: VectorSearchMethod.Range(42))),
238237
Scenario.VectorWithRangeAndDistanceAlias => query.VectorSearch(new("@vector1", VectorData.Raw(vec),
239-
method: VectorSearchMethod.Range(42, distanceAlias: "dist_alias"))),
238+
method: VectorSearchMethod.Range(42, null, distanceAlias: "dist_alias"))),
240239
Scenario.VectorWithRangeAndEpsilon => query.VectorSearch(new("@vector1", VectorData.Raw(vec),
241240
method: VectorSearchMethod.Range(42, epsilon: 0.1))),
242241
Scenario.VectorWithNearest => query.VectorSearch(new("@vector1", VectorData.Raw(vec),
243242
method: VectorSearchMethod.NearestNeighbour())),
244243
Scenario.VectorWithNearestCount => query.VectorSearch(new("@vector1", VectorData.Raw(vec),
245244
method: VectorSearchMethod.NearestNeighbour(20))),
246245
Scenario.VectorWithNearestDistAlias => query.VectorSearch(new("@vector1", VectorData.Raw(vec),
247-
method: VectorSearchMethod.NearestNeighbour(distanceAlias: "dist_alias"))),
246+
method: VectorSearchMethod.NearestNeighbour(null, null, distanceAlias: "dist_alias"))),
248247
Scenario.VectorWithNearestMaxCandidates => query.VectorSearch(new("@vector1", VectorData.Raw(vec),
249-
method: VectorSearchMethod.NearestNeighbour(maxTopCandidates: 10))),
248+
method: VectorSearchMethod.NearestNeighbour(null, maxTopCandidates: 10))),
250249
Scenario.VectorWithTagFilter => query.VectorSearch(new("@vector1", VectorData.Raw(vec),
251250
filter: "@tag1:{foo}")),
252251
Scenario.VectorWithNumericFilter => query.VectorSearch(new("@vector1", VectorData.Raw(vec),

tests/NRedisStack.Tests/Search/HybridSearchUnitTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public void BasicVectorSearch_WithKNN(bool withScoreAlias, bool withDistanceAlia
147147
HybridSearchQuery query = new();
148148
var searchConfig = new HybridSearchQuery.VectorSearchConfig("vField", SomeRandomDataHere);
149149
if (withScoreAlias) searchConfig = searchConfig.WithScoreAlias("my_score_alias");
150-
searchConfig = searchConfig.WithMethod(VectorSearchMethod.NearestNeighbour(
150+
searchConfig = searchConfig.WithMethod(VectorSearchMethod.NearestNeighbour(null, null,
151151
distanceAlias: withDistanceAlias ? "my_distance_alias" : null));
152152
query.VectorSearch(searchConfig);
153153

@@ -210,7 +210,7 @@ public void BasicVectorSearch_WithRange(bool withScoreAlias, bool withDistanceAl
210210
HybridSearchQuery query = new();
211211
var searchConfig = new HybridSearchQuery.VectorSearchConfig("vfield", SomeRandomDataHere);
212212
if (withScoreAlias) searchConfig = searchConfig.WithScoreAlias("my_score_alias");
213-
searchConfig = searchConfig.WithMethod(VectorSearchMethod.Range(4.2,
213+
searchConfig = searchConfig.WithMethod(VectorSearchMethod.Range(4.2, null,
214214
distanceAlias: withDistanceAlias ? "my_distance_alias" : null));
215215
query.VectorSearch(searchConfig);
216216

0 commit comments

Comments
 (0)