Skip to content

Commit

Permalink
Handle FT.PROFILE response (impacted with Coordinator) processing wit…
Browse files Browse the repository at this point in the history
…h "ProfilingInformation" (#373)

* handle ft.profile response processing with "ProfilingInformation"

* fix formatting

* make old methods obsolete
atakavci authored Jan 23, 2025
1 parent 744814c commit 64bed3f
Showing 8 changed files with 272 additions and 41 deletions.
17 changes: 17 additions & 0 deletions src/NRedisStack/ResponseParser.cs
Original file line number Diff line number Diff line change
@@ -694,6 +694,15 @@ public static Tuple<SearchResult, Dictionary<string, RedisResult>> ToProfileSear
return new Tuple<SearchResult, Dictionary<string, RedisResult>>(searchResult, profile);
}

public static Tuple<SearchResult, ProfilingInformation> ParseProfileSearchResult(this RedisResult result, Query q)
{
var results = (RedisResult[])result!;

var searchResult = results[0].ToSearchResult(q);
var profile = new ProfilingInformation(results[1]);
return new Tuple<SearchResult, ProfilingInformation>(searchResult, profile);
}

public static SearchResult ToSearchResult(this RedisResult result, Query q)
{
return new SearchResult((RedisResult[])result!, !q.NoContent, q.WithScores, q.WithPayloads/*, q.ExplainScore*/);
@@ -707,6 +716,14 @@ public static Tuple<AggregationResult, Dictionary<string, RedisResult>> ToProfil
return new Tuple<AggregationResult, Dictionary<string, RedisResult>>(aggregateResult, profile);
}

public static Tuple<AggregationResult, ProfilingInformation> ParseProfileAggregateResult(this RedisResult result, AggregationRequest q)
{
var results = (RedisResult[])result!;
var aggregateResult = results[0].ToAggregationResult(q);
var profile = new ProfilingInformation(results[1]);
return new Tuple<AggregationResult, ProfilingInformation>(aggregateResult, profile);
}

public static AggregationResult ToAggregationResult(this RedisResult result, AggregationRequest query)
{
if (query.IsWithCursor())
20 changes: 20 additions & 0 deletions src/NRedisStack/Search/ISearchCommands.cs
Original file line number Diff line number Diff line change
@@ -177,17 +177,37 @@ public interface ISearchCommands
/// <param name="q">The query string.</param>
/// <param name="limited">Removes details of reader iterator.</param>
/// <returns></returns>
[Obsolete("Consider using ProfileOnSearch with Redis CE 8.0 and later")]
Tuple<SearchResult, Dictionary<string, RedisResult>> ProfileSearch(string indexName, Query q, bool limited = false);

/// <summary>
/// Apply FT.SEARCH command to collect performance details.
/// </summary>
/// <param name="indexName">The index name, created using FT.CREATE.</param>
/// <param name="q">The query string.</param>
/// <param name="limited">Removes details of reader iterator.</param>
/// <returns></returns>
Tuple<SearchResult, ProfilingInformation> ProfileOnSearch(string indexName, Query q, bool limited = false);

/// <summary>
/// Apply FT.AGGREGATE command to collect performance details.
/// </summary>
/// <param name="indexName">The index name, created using FT.CREATE.</param>
/// <param name="query">The query string.</param>
/// <param name="limited">Removes details of reader iterator.</param>
/// <returns></returns>
[Obsolete("Consider using ProfileOnAggregate with Redis CE 8.0 and later")]
Tuple<AggregationResult, Dictionary<string, RedisResult>> ProfileAggregate(string indexName, AggregationRequest query, bool limited = false);

/// <summary>
/// Apply FT.AGGREGATE command to collect performance details.
/// </summary>
/// <param name="indexName">The index name, created using FT.CREATE.</param>
/// <param name="query">The query string.</param>
/// <param name="limited">Removes details of reader iterator.</param>
/// <returns></returns>
Tuple<AggregationResult, ProfilingInformation> ProfileOnAggregate(string indexName, AggregationRequest query, bool limited = false);

/// <summary>
/// Search the index
/// </summary>
20 changes: 19 additions & 1 deletion src/NRedisStack/Search/ISearchCommandsAsync.cs
Original file line number Diff line number Diff line change
@@ -169,16 +169,24 @@ public interface ISearchCommandsAsync
/// <remarks><seealso href="https://redis.io/commands/ft.info"/></remarks>
Task<InfoResult> InfoAsync(RedisValue index);


/// <summary>
/// Apply FT.SEARCH command to collect performance details.
/// </summary>
/// <param name="indexName">The index name, created using FT.CREATE.</param>
/// <param name="q">The query string.</param>
/// <param name="limited">Removes details of reader iterator.</param>
/// <returns></returns>
[Obsolete("Consider using ProfileOnSearchAsync with Redis CE 8.0 and later")]
Task<Tuple<SearchResult, Dictionary<string, RedisResult>>> ProfileSearchAsync(string indexName, Query q, bool limited = false);

/// <summary>
/// Apply FT.SEARCH command to collect performance details.
/// </summary>
/// <param name="indexName">The index name, created using FT.CREATE.</param>
/// <param name="q">The query string.</param>
/// <param name="limited">Removes details of reader iterator.</param>
/// <returns></returns>
Task<Tuple<SearchResult, ProfilingInformation>> ProfileOnSearchAsync(string indexName, Query q, bool limited = false);

/// <summary>
/// Apply FT.AGGREGATE command to collect performance details.
@@ -187,8 +195,18 @@ public interface ISearchCommandsAsync
/// <param name="query">The query string.</param>
/// <param name="limited">Removes details of reader iterator.</param>
/// <returns></returns>
[Obsolete("Consider using ProfileOnAggregateAsync with Redis CE 8.0 and later")]
Task<Tuple<AggregationResult, Dictionary<string, RedisResult>>> ProfileAggregateAsync(string indexName, AggregationRequest query, bool limited = false);

/// <summary>
/// Apply FT.AGGREGATE command to collect performance details.
/// </summary>
/// <param name="indexName">The index name, created using FT.CREATE.</param>
/// <param name="query">The query string.</param>
/// <param name="limited">Removes details of reader iterator.</param>
/// <returns></returns>
Task<Tuple<AggregationResult, ProfilingInformation>> ProfileOnAggregateAsync(string indexName, AggregationRequest query, bool limited = false);

/// <summary>
/// Search the index
/// </summary>
15 changes: 15 additions & 0 deletions src/NRedisStack/Search/ProfilingInformation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using StackExchange.Redis;

namespace NRedisStack.Search
{

public class ProfilingInformation
{
public RedisResult Info { get; private set; }
public ProfilingInformation(RedisResult info)
{
this.Info = info;
}

}
}
21 changes: 20 additions & 1 deletion src/NRedisStack/Search/SearchCommands.cs
Original file line number Diff line number Diff line change
@@ -131,18 +131,37 @@ public InfoResult Info(RedisValue index) =>
new InfoResult(_db.Execute(SearchCommandBuilder.Info(index)));

/// <inheritdoc/>
[Obsolete("Consider using ProfileOnSearch with Redis CE 8.0 and later")]
public Tuple<SearchResult, Dictionary<string, RedisResult>> ProfileSearch(string indexName, Query q, bool limited = false)
{
return _db.Execute(SearchCommandBuilder.ProfileSearch(indexName, q, limited))
.ToProfileSearchResult(q);
.ToProfileSearchResult(q);
}

/// <inheritdoc/>
public Tuple<SearchResult, ProfilingInformation> ProfileOnSearch(string indexName, Query q, bool limited = false)
{
return _db.Execute(SearchCommandBuilder.ProfileSearch(indexName, q, limited))
.ParseProfileSearchResult(q);
}

/// <inheritdoc/>
[Obsolete("Consider using ProfileOnAggregate with Redis CE 8.0 and later")]
public Tuple<AggregationResult, Dictionary<string, RedisResult>> ProfileAggregate(string indexName, AggregationRequest query, bool limited = false)
{
setDefaultDialectIfUnset(query);
return _db.Execute(SearchCommandBuilder.ProfileAggregate(indexName, query, limited))
.ToProfileAggregateResult(query);
}

/// <inheritdoc/>
public Tuple<AggregationResult, ProfilingInformation> ProfileOnAggregate(string indexName, AggregationRequest query, bool limited = false)
{
setDefaultDialectIfUnset(query);
return _db.Execute(SearchCommandBuilder.ProfileAggregate(indexName, query, limited))
.ParseProfileAggregateResult(query);
}

/// <inheritdoc/>
public SearchResult Search(string indexName, Query q)
{
15 changes: 15 additions & 0 deletions src/NRedisStack/Search/SearchCommandsAsync.cs
Original file line number Diff line number Diff line change
@@ -162,17 +162,32 @@ public async Task<InfoResult> InfoAsync(RedisValue index) =>
new InfoResult(await _db.ExecuteAsync(SearchCommandBuilder.Info(index)));

/// <inheritdoc/>
[Obsolete("Consider using ProfileOnSearchAsync with Redis CE 8.0 and later")]
public async Task<Tuple<SearchResult, Dictionary<string, RedisResult>>> ProfileSearchAsync(string indexName, Query q, bool limited = false)
{
return (await _db.ExecuteAsync(SearchCommandBuilder.ProfileSearch(indexName, q, limited)))
.ToProfileSearchResult(q);
}

/// <inheritdoc/>
public async Task<Tuple<SearchResult, ProfilingInformation>> ProfileOnSearchAsync(string indexName, Query q, bool limited = false)
{
return (await _db.ExecuteAsync(SearchCommandBuilder.ProfileSearch(indexName, q, limited)))
.ParseProfileSearchResult(q);
}
/// <inheritdoc/>
[Obsolete("Consider using ProfileOnSearchAsync with Redis CE 8.0 and later")]
public async Task<Tuple<AggregationResult, Dictionary<string, RedisResult>>> ProfileAggregateAsync(string indexName, AggregationRequest query, bool limited = false)
{
return (await _db.ExecuteAsync(SearchCommandBuilder.ProfileAggregate(indexName, query, limited)))
.ToProfileAggregateResult(query);
}
/// <inheritdoc/>
public async Task<Tuple<AggregationResult, ProfilingInformation>> ProfileOnAggregateAsync(string indexName, AggregationRequest query, bool limited = false)
{
return (await _db.ExecuteAsync(SearchCommandBuilder.ProfileAggregate(indexName, query, limited)))
.ParseProfileAggregateResult(query);
}

/// <inheritdoc/>
public async Task<SearchResult> SearchAsync(string indexName, Query q)
20 changes: 20 additions & 0 deletions tests/NRedisStack.Tests/CustomAssertions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Xunit;

namespace NRedisStack.Tests;

public static class CustomAssertions
{
// Generic method to assert that 'actual' is greater than 'expected'
public static void GreaterThan<T>(T actual, T expected) where T : IComparable<T>
{
Assert.True(actual.CompareTo(expected) > 0,
$"Failure: Expected value to be greater than {expected}, but found {actual}.");
}

// Generic method to assert that 'actual' is less than 'expected'
public static void LessThan<T>(T actual, T expected) where T : IComparable<T>
{
Assert.True(actual.CompareTo(expected) < 0,
$"Failure: Expected value to be less than {expected}, but found {actual}.");
}
}
185 changes: 146 additions & 39 deletions tests/NRedisStack.Tests/Search/SearchTests.cs
Original file line number Diff line number Diff line change
@@ -2776,7 +2776,7 @@ public async Task getSuggestionLengthAndDeleteSuggestionAsync()
Assert.Equal(2L, await ft.SugLenAsync(key));
}

[SkipIfRedis(Is.Enterprise, Comparison.GreaterThanOrEqual, "7.3.240")]
[SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.9")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public void TestProfileSearch(string endpointId)
{
@@ -2790,17 +2790,16 @@ public void TestProfileSearch(string endpointId)
new HashEntry("t1", "foo"),
new HashEntry("t2", "bar")});

var profile = ft.ProfileSearch(index, new Query("foo"));
var profile = ft.ProfileOnSearch(index, new Query("foo"));
// Iterators profile={Type=TEXT, Time=0.0, Term=foo, Counter=1, Size=1}
profile.Item2["Iterators profile"].ToDictionary();
var iteratorsProfile = profile.Item2["Iterators profile"].ToDictionary();
Assert.Equal("TEXT", iteratorsProfile["Type"].ToString());
Assert.Equal("foo", iteratorsProfile["Term"].ToString());
Assert.Equal("1", iteratorsProfile["Counter"].ToString());
Assert.Equal("1", iteratorsProfile["Size"].ToString());
var info = (RedisResult[])profile.Item2.Info;
int shardsIndex = Array.FindIndex(info, item => item.ToString() == "Shards");
int coordinatorIndex = Array.FindIndex(info, item => item.ToString() == "Coordinator");
CustomAssertions.GreaterThan(shardsIndex, -1);
CustomAssertions.GreaterThan(coordinatorIndex, -1);
}

[SkipIfRedis(Is.Enterprise, Comparison.GreaterThanOrEqual, "7.3.240")]
[SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.9")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public async Task TestProfileSearchAsync(string endpointId)
{
@@ -2814,18 +2813,53 @@ public async Task TestProfileSearchAsync(string endpointId)
new HashEntry("t1", "foo"),
new HashEntry("t2", "bar")});

var profile = await ft.ProfileSearchAsync(index, new Query("foo"));
// Iterators profile={Type=TEXT, Time=0.0, Term=foo, Counter=1, Size=1}
profile.Item2["Iterators profile"].ToDictionary();
var iteratorsProfile = profile.Item2["Iterators profile"].ToDictionary();
Assert.Equal("TEXT", iteratorsProfile["Type"].ToString());
Assert.Equal("foo", iteratorsProfile["Term"].ToString());
Assert.Equal("1", iteratorsProfile["Counter"].ToString());
Assert.Equal("1", iteratorsProfile["Size"].ToString());
var profile = await ft.ProfileOnSearchAsync(index, new Query("foo"));
var info = (RedisResult[])profile.Item2.Info;
int shardsIndex = Array.FindIndex(info, item => item.ToString() == "Shards");
int coordinatorIndex = Array.FindIndex(info, item => item.ToString() == "Coordinator");
CustomAssertions.GreaterThan(shardsIndex, -1);
CustomAssertions.GreaterThan(coordinatorIndex, -1);
}

[SkipIfRedis(Is.Enterprise, Comparison.GreaterThanOrEqual, "7.9")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public void TestProfileSearch_WithoutCoordinator(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
var ft = db.FT();

[SkipIfRedis(Is.Enterprise, Comparison.GreaterThanOrEqual, "7.3.240")]
Schema sc = new Schema().AddTextField("t1", 1.0).AddTextField("t2", 1.0);
Assert.True(ft.Create(index, new FTCreateParams(), sc));

db.HashSet("doc1", new HashEntry[] {
new HashEntry("t1", "foo"),
new HashEntry("t2", "bar")});

var profile = ft.ProfileSearch(index, new Query("foo"));
var info = profile.Item2;
CustomAssertions.GreaterThan(info.Count, 4);
}

[SkipIfRedis(Is.Enterprise, Comparison.GreaterThanOrEqual, "7.9")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public async Task TestProfileSearchAsync_WithoutCoordinator(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
var ft = db.FT();

Schema sc = new Schema().AddTextField("t1", 1.0).AddTextField("t2", 1.0);
Assert.True(ft.Create(index, new FTCreateParams(), sc));

db.HashSet("doc1", new HashEntry[] {
new HashEntry("t1", "foo"),
new HashEntry("t2", "bar")});

var profile = await ft.ProfileSearchAsync(index, new Query("foo"));
var info = profile.Item2;
CustomAssertions.GreaterThan(info.Count, 4);
}

[SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.9")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public void TestProfile(string endpointId)
{
@@ -2836,28 +2870,100 @@ public void TestProfile(string endpointId)
db.HashSet("1", "t", "hello");
db.HashSet("2", "t", "world");

// check using Query
var q = new Query("hello|world").SetNoContent();
var profileSearch = ft.ProfileOnSearch(index, q);
var searchRes = profileSearch.Item1;
var searchDet = (RedisResult[])profileSearch.Item2.Info;

Assert.Equal(2, searchRes.Documents.Count);
int shardsIndex = Array.FindIndex(searchDet, item => item.ToString() == "Shards");
int coordinatorIndex = Array.FindIndex(searchDet, item => item.ToString() == "Coordinator");
CustomAssertions.GreaterThan(shardsIndex, -1);
CustomAssertions.GreaterThan(coordinatorIndex, -1);

// check using AggregationRequest
var aggReq = new AggregationRequest("*").Load(FieldName.Of("t")).Apply("startswith(@t, 'hel')", "prefix");
var profileAggregate = ft.ProfileOnAggregate(index, aggReq);
var aggregateRes = profileAggregate.Item1;
var aggregateDet = (RedisResult[])profileAggregate.Item2.Info;

Assert.Equal(2, aggregateRes.TotalResults);
shardsIndex = Array.FindIndex(aggregateDet, item => item.ToString() == "Shards");
coordinatorIndex = Array.FindIndex(aggregateDet, item => item.ToString() == "Coordinator");
CustomAssertions.GreaterThan(shardsIndex, -1);
CustomAssertions.GreaterThan(coordinatorIndex, -1);
}

[SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.9")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public async Task TestProfileAsync(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
var ft = db.FT();

await ft.CreateAsync(index, new Schema().AddTextField("t")); // Calling FT.CREATR without FTCreateParams
db.HashSet("1", "t", "hello");
db.HashSet("2", "t", "world");

// check using Query
var q = new Query("hello|world").SetNoContent();
var profileSearch = await ft.ProfileOnSearchAsync(index, q);
var searchRes = profileSearch.Item1;
var searchDet = (RedisResult[])profileSearch.Item2.Info;

Assert.Equal(2, searchRes.Documents.Count);
int shardsIndex = Array.FindIndex(searchDet, item => item.ToString() == "Shards");
int coordinatorIndex = Array.FindIndex(searchDet, item => item.ToString() == "Coordinator");
CustomAssertions.GreaterThan(shardsIndex, -1);
CustomAssertions.GreaterThan(coordinatorIndex, -1);

// check using AggregationRequest
var aggReq = new AggregationRequest("*").Load(FieldName.Of("t")).Apply("startswith(@t, 'hel')", "prefix");
var profileAggregate = await ft.ProfileOnAggregateAsync(index, aggReq);
var aggregateRes = profileAggregate.Item1;
var aggregateDet = (RedisResult[])profileAggregate.Item2.Info;

Assert.Equal(2, aggregateRes.TotalResults);
shardsIndex = Array.FindIndex(aggregateDet, item => item.ToString() == "Shards");
coordinatorIndex = Array.FindIndex(aggregateDet, item => item.ToString() == "Coordinator");
CustomAssertions.GreaterThan(shardsIndex, -1);
CustomAssertions.GreaterThan(coordinatorIndex, -1);
}

[SkipIfRedis(Is.Enterprise, Comparison.GreaterThanOrEqual, "7.9")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public void TestProfile_WithoutCoordinator(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
var ft = db.FT();

ft.Create(index, new Schema().AddTextField("t")); // Calling FT.CREATR without FTCreateParams
db.HashSet("1", "t", "hello");
db.HashSet("2", "t", "world");

// check using Query
var q = new Query("hello|world").SetNoContent();
var profileSearch = ft.ProfileSearch(index, q);
var searchRes = profileSearch.Item1;
var searchDet = profileSearch.Item2;

Assert.Equal(5, searchDet.Count);
Assert.Equal(2, searchRes.Documents.Count);

CustomAssertions.GreaterThan(searchDet.Count, 4);

// check using AggregationRequest
var aggReq = new AggregationRequest("*").Load(FieldName.Of("t")).Apply("startswith(@t, 'hel')", "prefix");
var profileAggregate = ft.ProfileAggregate(index, aggReq);
var aggregateRes = profileAggregate.Item1;
var aggregateDet = profileAggregate.Item2;
Assert.Equal(5, aggregateDet.Count);

Assert.Equal(2, aggregateRes.TotalResults);
CustomAssertions.GreaterThan(aggregateDet.Count, 4);
}

[SkipIfRedis(Is.Enterprise, Comparison.GreaterThanOrEqual, "7.3.240")]
[SkipIfRedis(Is.Enterprise, Comparison.GreaterThanOrEqual, "7.9")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public async Task TestProfileAsync(string endpointId)
public async Task TestProfileAsync_WithoutCoordinator(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
var ft = db.FT();
@@ -2872,19 +2978,20 @@ public async Task TestProfileAsync(string endpointId)
var searchRes = profileSearch.Item1;
var searchDet = profileSearch.Item2;

Assert.Equal(5, searchDet.Count);
Assert.Equal(2, searchRes.Documents.Count);
CustomAssertions.GreaterThan(searchDet.Count, 4);

// check using AggregationRequest
var aggReq = new AggregationRequest("*").Load(FieldName.Of("t")).Apply("startswith(@t, 'hel')", "prefix");
var profileAggregate = await ft.ProfileAggregateAsync(index, aggReq);
var aggregateRes = profileAggregate.Item1;
var aggregateDet = profileAggregate.Item2;
Assert.Equal(5, aggregateDet.Count);

Assert.Equal(2, aggregateRes.TotalResults);
CustomAssertions.GreaterThan(searchDet.Count, 4);
}

[SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.3.242")]
[SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.3.240")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public void TestProfileIssue306(string endpointId)
{
@@ -2897,24 +3004,24 @@ public void TestProfileIssue306(string endpointId)

// check using Query
var q = new Query("hello|world").SetNoContent();
var profileSearch = ft.ProfileSearch(index, q);
var profileSearch = ft.ProfileOnSearch(index, q);
var searchRes = profileSearch.Item1;
var searchDet = profileSearch.Item2;
var searchDet = (RedisResult[])profileSearch.Item2.Info;

Assert.Equal(6, searchDet.Count);
CustomAssertions.GreaterThan(searchDet.Length, 3);
Assert.Equal(2, searchRes.Documents.Count);


// check using AggregationRequest
var aggReq = new AggregationRequest("*").Load(FieldName.Of("t")).Apply("startswith(@t, 'hel')", "prefix");
var profileAggregate = ft.ProfileAggregate(index, aggReq);
var profileAggregate = ft.ProfileOnAggregate(index, aggReq);
var aggregateRes = profileAggregate.Item1;
var aggregateDet = profileAggregate.Item2;
Assert.True(aggregateDet.Count >= 6);
var aggregateDet = (RedisResult[])profileAggregate.Item2.Info;
CustomAssertions.GreaterThan(aggregateDet.Length, 3);
Assert.Equal(2, aggregateRes.TotalResults);
}

[SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.3.242")]
[SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.3.240")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public async Task TestProfileAsyncIssue306(string endpointId)
{
@@ -2927,19 +3034,19 @@ public async Task TestProfileAsyncIssue306(string endpointId)

// check using Query
var q = new Query("hello|world").SetNoContent();
var profileSearch = await ft.ProfileSearchAsync(index, q);
var profileSearch = await ft.ProfileOnSearchAsync(index, q);
var searchRes = profileSearch.Item1;
var searchDet = profileSearch.Item2;
var searchDet = (RedisResult[])profileSearch.Item2.Info;

Assert.Equal(6, searchDet.Count);
CustomAssertions.GreaterThan(searchDet.Length, 3);
Assert.Equal(2, searchRes.Documents.Count);

// check using AggregationRequest
var aggReq = new AggregationRequest("*").Load(FieldName.Of("t")).Apply("startswith(@t, 'hel')", "prefix");
var profileAggregate = await ft.ProfileAggregateAsync(index, aggReq);
var profileAggregate = await ft.ProfileOnAggregateAsync(index, aggReq);
var aggregateRes = profileAggregate.Item1;
var aggregateDet = profileAggregate.Item2;
Assert.True(aggregateDet.Count >= 6);
var aggregateDet = (RedisResult[])profileAggregate.Item2.Info;
CustomAssertions.GreaterThan(aggregateDet.Length, 3);
Assert.Equal(2, aggregateRes.TotalResults);
}

0 comments on commit 64bed3f

Please sign in to comment.