Skip to content

Commit 5dc09af

Browse files
authored
Cleanup (#36)
* Cleanup * Fix TestRankCommands
1 parent 5ef9e4f commit 5dc09af

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/NRedisStack/Search/AggregationRequest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Text;
4+
using NRedisStack.Literals;
45
// using NRediSearch.Aggregation.Reducers;
56
using StackExchange.Redis;
67

@@ -125,7 +126,7 @@ public AggregationRequest GroupBy(Group group)
125126

126127
public AggregationRequest Filter(string expression)
127128
{
128-
args.Add("FILTER");
129+
args.Add(SearchArgs.FILTER);
129130
args.Add(expression);
130131
return this;
131132
}

src/NRedisStack/Search/Query.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Globalization;
3+
using NRedisStack.Literals;
34
using NRedisStack.Search;
45
using StackExchange.Redis;
56

@@ -45,7 +46,7 @@ public NumericFilter(string property, double min, double max) : this(property, m
4546

4647
internal override void SerializeRedisArgs(List<object> args)
4748
{
48-
static RedisValue FormatNum(double num, bool exclude) //TODO: understand this:
49+
static RedisValue FormatNum(double num, bool exclude)
4950
{
5051
if (!exclude || double.IsInfinity(num))
5152
{
@@ -54,7 +55,7 @@ static RedisValue FormatNum(double num, bool exclude) //TODO: understand this:
5455
// need to add leading bracket
5556
return "(" + num.ToString("G17", NumberFormatInfo.InvariantInfo);
5657
}
57-
args.Add("FILTER");
58+
args.Add(SearchArgs.FILTER);
5859
args.Add(Property);
5960
args.Add(FormatNum(min, exclusiveMin));
6061
args.Add(FormatNum(max, exclusiveMax));
@@ -357,7 +358,7 @@ internal void SerializeRedisArgs(List<object> args)
357358
args.Add(_returnFields.Length);
358359
args.AddRange(_returnFields);
359360
}
360-
else if (_returnFieldsNames?.Length > 0) // TODO: understad this
361+
else if (_returnFieldsNames?.Length > 0)
361362
{
362363
args.Add("RETURN");
363364
int returnCountIndex = args.Count;

src/NRedisStack/Search/SearchCommands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public async Task<bool> AlterAsync(string index, Schema schema, bool skipInitial
213213
public Dictionary<string, string> ConfigGet(string option)
214214
{
215215
var result = _db.Execute(FT.CONFIG, "GET", option);
216-
return result.ToConfigDictionary(); // TODO: fix all tests to be like this
216+
return result.ToConfigDictionary();
217217
}
218218

219219
/// <summary>

tests/NRedisStack.Tests/Tdigest/TdigestTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ public void TestRankCommands()
119119
var tdigest = db.TDIGEST();
120120
tdigest.Create(key);
121121
tdigest.Add(key, 2d, 3d, 5d);
122-
Assert.Equal(new long[] { 1l, 2l }, tdigest.Rank(key, 2, 4));
122+
Assert.Equal(new long[] { 1, 2 }, tdigest.Rank(key, 2, 4));
123123
Assert.Equal(new long[] { 0, 1 }, tdigest.RevRank(key, 5, 4));
124124
Assert.Equal(new double[] { 2, 3 }, tdigest.ByRank(key, 0, 1));
125-
Assert.Equal(new double[] { 5, 3 }, tdigest.ByRevRank(key, 1, 2));
125+
Assert.Equal(new double[] { 5, 3 }, tdigest.ByRevRank(key, 0, 1));
126126
}
127127

128128
// [Fact]

0 commit comments

Comments
 (0)