Commit 80d7d50a authored by Nick Craver's avatar Nick Craver

Cleanup for NRediSearch

Lots of documentation and formatting fixes, no functional changes.
parent 965453e2
This diff is collapsed.
...@@ -17,7 +17,7 @@ public class BuilderTest : RediSearchTestBase ...@@ -17,7 +17,7 @@ public class BuilderTest : RediSearchTestBase
public BuilderTest(ITestOutputHelper output) : base(output) { } public BuilderTest(ITestOutputHelper output) : base(output) { }
[Fact] [Fact]
public void testTag() public void TestTag()
{ {
Value v = Tags("foo"); Value v = Tags("foo");
Assert.Equal("{foo}", v.ToString()); Assert.Equal("{foo}", v.ToString());
...@@ -26,16 +26,13 @@ public void testTag() ...@@ -26,16 +26,13 @@ public void testTag()
} }
[Fact] [Fact]
public void testEmptyTag() public void TestEmptyTag()
{ {
Assert.Throws<ArgumentException>(() => Assert.Throws<ArgumentException>(() => Tags());
{
Tags();
});
} }
[Fact] [Fact]
public void testRange() public void TestRange()
{ {
Value v = Between(1, 10); Value v = Between(1, 10);
Assert.Equal("[1.0 10.0]", v.ToString()); Assert.Equal("[1.0 10.0]", v.ToString());
...@@ -60,7 +57,7 @@ public void testRange() ...@@ -60,7 +57,7 @@ public void testRange()
} }
[Fact] [Fact]
public void testIntersectionBasic() public void TestIntersectionBasic()
{ {
INode n = Intersect().Add("name", "mark"); INode n = Intersect().Add("name", "mark");
Assert.Equal("@name:mark", n.ToString()); Assert.Equal("@name:mark", n.ToString());
...@@ -70,7 +67,7 @@ public void testIntersectionBasic() ...@@ -70,7 +67,7 @@ public void testIntersectionBasic()
} }
[Fact] [Fact]
public void testIntersectionNested() public void TestIntersectionNested()
{ {
INode n = Intersect(). INode n = Intersect().
Add(Union("name", Value("mark"), Value("dvir"))). Add(Union("name", Value("mark"), Value("dvir"))).
...@@ -79,14 +76,15 @@ public void testIntersectionNested() ...@@ -79,14 +76,15 @@ public void testIntersectionNested()
Assert.Equal("(@name:(mark|dvir) @time:[100.0 200.0] -@created:[-inf (1000.0])", n.ToString()); Assert.Equal("(@name:(mark|dvir) @time:[100.0 200.0] -@created:[-inf (1000.0])", n.ToString());
} }
static string GetArgsString(AggregationRequest request) private static string GetArgsString(AggregationRequest request)
{ {
var args = new List<object>(); var args = new List<object>();
request.SerializeRedisArgs(args); request.SerializeRedisArgs(args);
return string.Join(" ", args); return string.Join(" ", args);
} }
[Fact] [Fact]
public void testAggregation() public void TestAggregation()
{ {
Assert.Equal("*", GetArgsString(new AggregationRequest())); Assert.Equal("*", GetArgsString(new AggregationRequest()));
AggregationRequest r = new AggregationRequest(). AggregationRequest r = new AggregationRequest().
......
...@@ -10,7 +10,7 @@ namespace NRediSearch.Test ...@@ -10,7 +10,7 @@ namespace NRediSearch.Test
public abstract class RediSearchTestBase : IDisposable public abstract class RediSearchTestBase : IDisposable
{ {
protected readonly ITestOutputHelper Output; protected readonly ITestOutputHelper Output;
public RediSearchTestBase(ITestOutputHelper output) protected RediSearchTestBase(ITestOutputHelper output)
{ {
muxer = GetWithFT(output); muxer = GetWithFT(output);
Output = output; Output = output;
...@@ -82,7 +82,7 @@ internal static ConnectionMultiplexer GetWithFT(ITestOutputHelper output) ...@@ -82,7 +82,7 @@ internal static ConnectionMultiplexer GetWithFT(ITestOutputHelper output)
return conn; return conn;
} }
static Dictionary<string, RedisValue> Parse(RedisResult module) private static Dictionary<string, RedisValue> Parse(RedisResult module)
{ {
var data = new Dictionary<string, RedisValue>(); var data = new Dictionary<string, RedisValue>();
var lines = (RedisResult[])module; var lines = (RedisResult[])module;
......
...@@ -9,7 +9,7 @@ namespace NRediSearch.Aggregation.Reducers ...@@ -9,7 +9,7 @@ namespace NRediSearch.Aggregation.Reducers
public abstract class Reducer public abstract class Reducer
{ {
public override string ToString() => Name; public override string ToString() => Name;
private string _field; private readonly string _field;
internal Reducer(string field) => _field = field; internal Reducer(string field) => _field = field;
......
...@@ -6,23 +6,22 @@ namespace NRediSearch.Aggregation.Reducers ...@@ -6,23 +6,22 @@ namespace NRediSearch.Aggregation.Reducers
{ {
public static class Reducers public static class Reducers
{ {
public static Reducer Count() => CountReducer.Instance; public static Reducer Count() => CountReducer.Instance;
sealed class CountReducer : Reducer private sealed class CountReducer : Reducer
{ {
internal static readonly Reducer Instance = new CountReducer(); internal static readonly Reducer Instance = new CountReducer();
private CountReducer() : base(null) { } private CountReducer() : base(null) { }
public override string Name => "COUNT"; public override string Name => "COUNT";
} }
sealed class SingleFieldReducer : Reducer private sealed class SingleFieldReducer : Reducer
{ {
private readonly string _name; public override string Name { get; }
internal SingleFieldReducer(string name, string field) : base(field) internal SingleFieldReducer(string name, string field) : base(field)
{ {
_name = name; Name = name;
} }
public override string Name => _name;
} }
public static Reducer CountDistinct(string field) => new SingleFieldReducer("COUNT_DISTINCT", field); public static Reducer CountDistinct(string field) => new SingleFieldReducer("COUNT_DISTINCT", field);
...@@ -41,7 +40,7 @@ internal SingleFieldReducer(string name, string field) : base(field) ...@@ -41,7 +40,7 @@ internal SingleFieldReducer(string name, string field) : base(field)
public static Reducer Quantile(string field, double percentile) => new QuantileReducer(field, percentile); public static Reducer Quantile(string field, double percentile) => new QuantileReducer(field, percentile);
sealed class QuantileReducer : Reducer private sealed class QuantileReducer : Reducer
{ {
private readonly double _percentile; private readonly double _percentile;
public QuantileReducer(string field, double percentile) : base(field) public QuantileReducer(string field, double percentile) : base(field)
...@@ -57,7 +56,7 @@ protected override void AddOwnArgs(List<object> args) ...@@ -57,7 +56,7 @@ protected override void AddOwnArgs(List<object> args)
public override string Name => "QUANTILE"; public override string Name => "QUANTILE";
} }
public static Reducer FirstValue(string field, SortedField sortBy) => new FirstValueReducer(field, sortBy); public static Reducer FirstValue(string field, SortedField sortBy) => new FirstValueReducer(field, sortBy);
sealed class FirstValueReducer : Reducer private sealed class FirstValueReducer : Reducer
{ {
private readonly SortedField? _sortBy; private readonly SortedField? _sortBy;
public FirstValueReducer(string field, SortedField? sortBy) : base(field) public FirstValueReducer(string field, SortedField? sortBy) : base(field)
...@@ -85,7 +84,7 @@ protected override void AddOwnArgs(List<object> args) ...@@ -85,7 +84,7 @@ protected override void AddOwnArgs(List<object> args)
public static Reducer RandomSample(string field, int size) => new RandomSampleReducer(field, size); public static Reducer RandomSample(string field, int size) => new RandomSampleReducer(field, size);
sealed class RandomSampleReducer : Reducer private sealed class RandomSampleReducer : Reducer
{ {
private readonly int _size; private readonly int _size;
public RandomSampleReducer(string field, int size) : base(field) public RandomSampleReducer(string field, int size) : base(field)
...@@ -100,6 +99,5 @@ protected override void AddOwnArgs(List<object> args) ...@@ -100,6 +99,5 @@ protected override void AddOwnArgs(List<object> args)
args.Add(_size.Boxed()); args.Add(_size.Boxed());
} }
} }
} }
} }
...@@ -50,9 +50,11 @@ public ConfiguredIndexOptions(IndexOptions options) ...@@ -50,9 +50,11 @@ public ConfiguredIndexOptions(IndexOptions options)
{ {
_options = options; _options = options;
} }
/// <summary> /// <summary>
/// Set a custom stopword list /// Set a custom stopword list.
/// </summary> /// </summary>
/// <param name="stopwords">The new stopwords to use.</param>
public ConfiguredIndexOptions SetStopwords(params string[] stopwords) public ConfiguredIndexOptions SetStopwords(params string[] stopwords)
{ {
_stopwords = stopwords ?? throw new ArgumentNullException(nameof(stopwords)); _stopwords = stopwords ?? throw new ArgumentNullException(nameof(stopwords));
...@@ -179,7 +181,6 @@ public async Task<bool> CreateIndexAsync(Schema schema, IndexOptions options) ...@@ -179,7 +181,6 @@ public async Task<bool> CreateIndexAsync(Schema schema, IndexOptions options)
return (string)await _db.ExecuteAsync("FT.CREATE", args).ConfigureAwait(false) == "OK"; return (string)await _db.ExecuteAsync("FT.CREATE", args).ConfigureAwait(false) == "OK";
} }
/// <summary> /// <summary>
/// Create the index definition in redis /// Create the index definition in redis
/// </summary> /// </summary>
...@@ -435,7 +436,6 @@ public async Task<bool> AddHashAsync(RedisKey docId, double score, bool replace) ...@@ -435,7 +436,6 @@ public async Task<bool> AddHashAsync(RedisKey docId, double score, bool replace)
private static Dictionary<string, RedisValue> ParseGetInfo(RedisResult value) private static Dictionary<string, RedisValue> ParseGetInfo(RedisResult value)
{ {
var res = (RedisResult[])value; var res = (RedisResult[])value;
var info = new Dictionary<string, RedisValue>(); var info = new Dictionary<string, RedisValue>();
for (int i = 0; i < res.Length; i += 2) for (int i = 0; i < res.Length; i += 2)
...@@ -659,40 +659,47 @@ public async Task<string> ExplainAsync(Query q) ...@@ -659,40 +659,47 @@ public async Task<string> ExplainAsync(Query q)
} }
/// <summary> /// <summary>
/// Get a document from the index /// Get a document from the index.
/// </summary> /// </summary>
/// <param name="docId">The document ID to retrieve</param> /// <param name="docId">The document ID to retrieve.</param>
/// <returns>The document as stored in the index. If the document does not exist, null is returned.</returns> /// <returns>The document as stored in the index. If the document does not exist, null is returned.</returns>
public Document GetDocument(string docId) public Document GetDocument(string docId)
=> Document.Parse(docId, DbSync.Execute("FT.GET", _boxedIndexName, docId)); => Document.Parse(docId, DbSync.Execute("FT.GET", _boxedIndexName, docId));
/// <summary> /// <summary>
/// Get a document from the index /// Get a document from the index.
/// </summary> /// </summary>
/// <param name="docId">The document ID to retrieve</param> /// <param name="docId">The document ID to retrieve.</param>
/// <returns>The document as stored in the index. If the document does not exist, null is returned.</returns> /// <returns>The document as stored in the index. If the document does not exist, null is returned.</returns>
public async Task<Document> GetDocumentAsync(string docId) public async Task<Document> GetDocumentAsync(string docId)
=> Document.Parse(docId, await _db.ExecuteAsync("FT.GET", _boxedIndexName, docId)); => Document.Parse(docId, await _db.ExecuteAsync("FT.GET", _boxedIndexName, docId).ConfigureAwait(false));
/// <summary> /// <summary>
/// Replace specific fields in a document. Unlike #replaceDocument(), fields not present in the field list /// Replace specific fields in a document. Unlike #replaceDocument(), fields not present in the field list
/// are not erased, but retained. This avoids reindexing the entire document if the new values are not /// are not erased, but retained. This avoids reindexing the entire document if the new values are not
/// indexed (though a reindex will happen /// indexed (though a reindex will happen).
/// </summary> /// </summary>
/// <param name="docId">The ID of the document.</param>
/// <param name="fields">The fields and values to update.</param>
/// <param name="score">The new score of the document.</param>
public bool UpdateDocument(string docId, Dictionary<string, RedisValue> fields, double score = 1.0) public bool UpdateDocument(string docId, Dictionary<string, RedisValue> fields, double score = 1.0)
{ {
var args = BuildAddDocumentArgs(docId, fields, score, false, AddOptions.ReplacementPolicy.Partial, null, null); var args = BuildAddDocumentArgs(docId, fields, score, false, AddOptions.ReplacementPolicy.Partial, null, null);
return (string)DbSync.Execute("FT.ADD", args) == "OK"; return (string)DbSync.Execute("FT.ADD", args) == "OK";
} }
/// <summary> /// <summary>
/// Replace specific fields in a document. Unlike #replaceDocument(), fields not present in the field list /// Replace specific fields in a document. Unlike #replaceDocument(), fields not present in the field list
/// are not erased, but retained. This avoids reindexing the entire document if the new values are not /// are not erased, but retained. This avoids reindexing the entire document if the new values are not
/// indexed (though a reindex will happen /// indexed (though a reindex will happen
/// </summary> /// </summary>
/// <param name="docId">The ID of the document.</param>
/// <param name="fields">The fields and values to update.</param>
/// <param name="score">The new score of the document.</param>
public async Task<bool> UpdateDocumentAsync(string docId, Dictionary<string, RedisValue> fields, double score = 1.0) public async Task<bool> UpdateDocumentAsync(string docId, Dictionary<string, RedisValue> fields, double score = 1.0)
{ {
var args = BuildAddDocumentArgs(docId, fields, score, false, AddOptions.ReplacementPolicy.Partial, null, null); var args = BuildAddDocumentArgs(docId, fields, score, false, AddOptions.ReplacementPolicy.Partial, null, null);
return ((string)await _db.ExecuteAsync("FT.ADD", args).ConfigureAwait(false) == "OK"); return (string)await _db.ExecuteAsync("FT.ADD", args).ConfigureAwait(false) == "OK";
} }
} }
} }
...@@ -30,7 +30,6 @@ public Document(string id, Dictionary<string, RedisValue> fields, double score, ...@@ -30,7 +30,6 @@ public Document(string id, Dictionary<string, RedisValue> fields, double score,
public IEnumerable<KeyValuePair<string, RedisValue>> GetProperties() => _properties; public IEnumerable<KeyValuePair<string, RedisValue>> GetProperties() => _properties;
public static Document Load(string id, double score, byte[] payload, RedisValue[] fields) public static Document Load(string id, double score, byte[] payload, RedisValue[] fields)
{ {
Document ret = new Document(id, score, payload); Document ret = new Document(id, score, payload);
...@@ -57,7 +56,7 @@ internal static Document Parse(string docId, RedisResult result) ...@@ -57,7 +56,7 @@ internal static Document Parse(string docId, RedisResult result)
if (result == null || result.IsNull) return null; if (result == null || result.IsNull) return null;
var arr = (RedisResult[])result; var arr = (RedisResult[])result;
var doc = new Document(docId); var doc = new Document(docId);
for(int i = 0; i < arr.Length; ) for(int i = 0; i < arr.Length; )
{ {
doc[(string)arr[i++]] = (RedisValue)arr[i++]; doc[(string)arr[i++]] = (RedisValue)arr[i++];
......
...@@ -12,12 +12,13 @@ public static class Extensions ...@@ -12,12 +12,13 @@ public static class Extensions
/// <summary> /// <summary>
/// Set a custom stopword list /// Set a custom stopword list
/// </summary> /// </summary>
/// <param name="options">The <see cref="IndexOptions"/> to set stopwords on.</param>
/// <param name="stopwords">The stopwords to set.</param>
public static ConfiguredIndexOptions SetStopwords(this IndexOptions options, params string[] stopwords) public static ConfiguredIndexOptions SetStopwords(this IndexOptions options, params string[] stopwords)
=> new ConfiguredIndexOptions(options).SetStopwords(stopwords); => new ConfiguredIndexOptions(options).SetStopwords(stopwords);
internal static string AsRedisString(this double value, bool forceDecimal = false) internal static string AsRedisString(this double value, bool forceDecimal = false)
{ {
if (double.IsNegativeInfinity(value)) if (double.IsNegativeInfinity(value))
{ {
return "-inf"; return "-inf";
......
...@@ -38,13 +38,13 @@ public static object Literal(this string value) ...@@ -38,13 +38,13 @@ public static object Literal(this string value)
return boxed; return boxed;
} }
private const int BOXED_MIN = -1, BOXED_MAX = 20;
const int BOXED_MIN = -1, BOXED_MAX = 20; private static readonly object[] s_Boxed = Enumerable.Range(BOXED_MIN, BOXED_MAX - BOXED_MIN).Select(i => (object)i).ToArray();
static readonly object[] s_Boxed = Enumerable.Range(BOXED_MIN, BOXED_MAX - BOXED_MIN).Select(i => (object)i).ToArray();
/// <summary> /// <summary>
/// Obtain a pre-boxed integer if possible, else box the inbound value /// Obtain a pre-boxed integer if possible, else box the inbound value
/// </summary> /// </summary>
/// <param name="value">The value to get a pre-boxed integer for.</param>
public static object Boxed(this int value) => value >= BOXED_MIN && value <= BOXED_MAX ? s_Boxed[value - BOXED_MIN] : value; public static object Boxed(this int value) => value >= BOXED_MIN && value <= BOXED_MAX ? s_Boxed[value - BOXED_MIN] : value;
} }
} }
This diff is collapsed.
...@@ -74,20 +74,20 @@ protected bool ShouldUseParens(ParenMode mode) ...@@ -74,20 +74,20 @@ protected bool ShouldUseParens(ParenMode mode)
} }
} }
public virtual string ToString(ParenMode parenMode) public virtual string ToString(ParenMode mode)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (ShouldUseParens(parenMode)) if (ShouldUseParens(mode))
{ {
sb.Append("("); sb.Append("(");
} }
var sj = new StringJoiner(sb, GetJoinString()); var sj = new StringJoiner(sb, GetJoinString());
foreach (var n in children) foreach (var n in children)
{ {
sj.Add(n.ToString(parenMode)); sj.Add(n.ToString(mode));
} }
if (ShouldUseParens(parenMode)) if (ShouldUseParens(mode))
{ {
sb.Append(")"); sb.Append(")");
} }
......
...@@ -6,7 +6,7 @@ namespace NRediSearch.QueryBuilder ...@@ -6,7 +6,7 @@ namespace NRediSearch.QueryBuilder
{ {
public sealed class RangeValue : Value public sealed class RangeValue : Value
{ {
private double from, to; private readonly double from, to;
private bool inclusiveMin = true, inclusiveMax = true; private bool inclusiveMin = true, inclusiveMax = true;
public override bool IsCombinable() => false; public override bool IsCombinable() => false;
......
...@@ -6,9 +6,9 @@ namespace NRediSearch.QueryBuilder ...@@ -6,9 +6,9 @@ namespace NRediSearch.QueryBuilder
{ {
internal ref struct StringJoiner // this is to replace a Java feature cleanly internal ref struct StringJoiner // this is to replace a Java feature cleanly
{ {
readonly StringBuilder _sb; private readonly StringBuilder _sb;
readonly string _delimiter; private readonly string _delimiter;
bool _isFirst; private bool _isFirst;
public StringJoiner(StringBuilder sb, string delimiter) public StringJoiner(StringBuilder sb, string delimiter)
{ {
_sb = sb; _sb = sb;
......
...@@ -16,7 +16,7 @@ public ValueNode(string field, string joinstr, params Value[] values) ...@@ -16,7 +16,7 @@ public ValueNode(string field, string joinstr, params Value[] values)
_joinString = joinstr; _joinString = joinstr;
} }
private static Value[] fromStrings(string[] values) private static Value[] FromStrings(string[] values)
{ {
Value[] objs = new Value[values.Length]; Value[] objs = new Value[values.Length];
for (int i = 0; i < values.Length; i++) for (int i = 0; i < values.Length; i++)
...@@ -27,7 +27,7 @@ private static Value[] fromStrings(string[] values) ...@@ -27,7 +27,7 @@ private static Value[] fromStrings(string[] values)
} }
public ValueNode(string field, string joinstr, params string[] values) public ValueNode(string field, string joinstr, params string[] values)
: this(field, joinstr, fromStrings(values)) { } : this(field, joinstr, FromStrings(values)) { }
private string FormatField() private string FormatField()
{ {
...@@ -69,7 +69,7 @@ private string ToStringDefault(ParenMode mode) ...@@ -69,7 +69,7 @@ private string ToStringDefault(ParenMode mode)
var sj = new StringJoiner(sb, _joinString); var sj = new StringJoiner(sb, _joinString);
foreach (var v in _values) foreach (var v in _values)
{ {
sj.Add(FormatField() + v.ToString()); sj.Add(FormatField() + v);
} }
if (useParen) if (useParen)
{ {
......
...@@ -23,7 +23,6 @@ public ValueValue(string s) ...@@ -23,7 +23,6 @@ public ValueValue(string s)
internal static Value[] Value(string[] s) => Array.ConvertAll(s, _ => Value(_)); internal static Value[] Value(string[] s) => Array.ConvertAll(s, _ => Value(_));
public static RangeValue Between(double from, double to) => new RangeValue(from, to); public static RangeValue Between(double from, double to) => new RangeValue(from, to);
public static RangeValue Between(int from, int to) => new RangeValue((double)from, (double)to); public static RangeValue Between(int from, int to) => new RangeValue((double)from, (double)to);
...@@ -47,7 +46,7 @@ public static Value Tags(params string[] tags) ...@@ -47,7 +46,7 @@ public static Value Tags(params string[] tags)
} }
return new TagValue("{" + string.Join(" | ", tags) + "}"); return new TagValue("{" + string.Join(" | ", tags) + "}");
} }
sealed class TagValue : Value private sealed class TagValue : Value
{ {
private readonly string s; private readonly string s;
public TagValue(string s) { this.s = s; } public TagValue(string s) { this.s = s; }
......
...@@ -80,9 +80,10 @@ internal override void SerializeRedisArgs(List<object> args) ...@@ -80,9 +80,10 @@ internal override void SerializeRedisArgs(List<object> args)
public List<Field> Fields { get; } = new List<Field>(); public List<Field> Fields { get; } = new List<Field>();
/// <summary> /// <summary>
/// Add a field to the schema /// Add a field to the schema.
/// </summary> /// </summary>
/// <returns>the schema object</returns> /// <param name="field">The <see cref="Field"/> to add.</param>
/// <returns>The <see cref="Schema"/> object.</returns>
public Schema AddField(Field field) public Schema AddField(Field field)
{ {
Fields.Add(field ?? throw new ArgumentNullException(nameof(field))); Fields.Add(field ?? throw new ArgumentNullException(nameof(field)));
...@@ -90,11 +91,11 @@ public Schema AddField(Field field) ...@@ -90,11 +91,11 @@ public Schema AddField(Field field)
} }
/// <summary> /// <summary>
/// Add a text field to the schema with a given weight /// Add a text field to the schema with a given weight.
/// </summary> /// </summary>
/// <param name="name">the field's name</param> /// <param name="name">The field's name.</param>
/// <param name="weight">its weight, a positive floating point number</param> /// <param name="weight">Its weight, a positive floating point number.</param>
/// <returns>the schema object</returns> /// <returns>The <see cref="Schema"/> object.</returns>
public Schema AddTextField(string name, double weight = 1.0) public Schema AddTextField(string name, double weight = 1.0)
{ {
Fields.Add(new TextField(name, weight)); Fields.Add(new TextField(name, weight));
...@@ -102,11 +103,11 @@ public Schema AddTextField(string name, double weight = 1.0) ...@@ -102,11 +103,11 @@ public Schema AddTextField(string name, double weight = 1.0)
} }
/// <summary> /// <summary>
/// Add a text field that can be sorted on /// Add a text field that can be sorted on.
/// </summary> /// </summary>
/// <param name="name">the field's name</param> /// <param name="name">The field's name.</param>
/// <param name="weight">its weight, a positive floating point number</param> /// <param name="weight">Its weight, a positive floating point number.</param>
/// <returns>the schema object</returns> /// <returns>The <see cref="Schema"/> object.</returns>
public Schema AddSortableTextField(string name, double weight = 1.0) public Schema AddSortableTextField(string name, double weight = 1.0)
{ {
Fields.Add(new TextField(name, weight, true)); Fields.Add(new TextField(name, weight, true));
...@@ -114,10 +115,10 @@ public Schema AddSortableTextField(string name, double weight = 1.0) ...@@ -114,10 +115,10 @@ public Schema AddSortableTextField(string name, double weight = 1.0)
} }
/// <summary> /// <summary>
/// Add a numeric field to the schema /// Add a numeric field to the schema.
/// </summary> /// </summary>
/// <param name="name">the field's name</param> /// <param name="name">The field's name.</param>
/// <returns>the schema object</returns> /// <returns>The <see cref="Schema"/> object.</returns>
public Schema AddGeoField(string name) public Schema AddGeoField(string name)
{ {
Fields.Add(new Field(name, FieldType.Geo, false)); Fields.Add(new Field(name, FieldType.Geo, false));
...@@ -125,10 +126,10 @@ public Schema AddGeoField(string name) ...@@ -125,10 +126,10 @@ public Schema AddGeoField(string name)
} }
/// <summary> /// <summary>
/// Add a numeric field to the schema /// Add a numeric field to the schema.
/// </summary> /// </summary>
/// <param name="name">the field's name</param> /// <param name="name">The field's name.</param>
/// <returns>the schema object</returns> /// <returns>The <see cref="Schema"/> object.</returns>
public Schema AddNumericField(string name) public Schema AddNumericField(string name)
{ {
Fields.Add(new Field(name, FieldType.Numeric, false)); Fields.Add(new Field(name, FieldType.Numeric, false));
...@@ -136,10 +137,10 @@ public Schema AddNumericField(string name) ...@@ -136,10 +137,10 @@ public Schema AddNumericField(string name)
} }
/// <summary> /// <summary>
/// Add a numeric field that can be sorted on /// Add a numeric field that can be sorted on.
/// </summary> /// </summary>
/// <param name="name">the field's name</param> /// <param name="name">The field's name.</param>
/// <returns>the schema object</returns> /// <returns>The <see cref="Schema"/> object.</returns>
public Schema AddSortableNumericField(string name) public Schema AddSortableNumericField(string name)
{ {
Fields.Add(new Field(name, FieldType.Numeric, true)); Fields.Add(new Field(name, FieldType.Numeric, true));
...@@ -166,11 +167,11 @@ internal override void SerializeRedisArgs(List<object> args) ...@@ -166,11 +167,11 @@ internal override void SerializeRedisArgs(List<object> args)
} }
/// <summary> /// <summary>
/// Add a TAG field /// Add a TAG field.
/// </summary> /// </summary>
/// <param name="name">the field's name</param> /// <param name="name">The field's name.</param>
/// <param name="separator">tag separator</param> /// <param name="separator">The tag separator.</param>
/// <returns>the schema object</returns> /// <returns>The <see cref="Schema"/> object.</returns>
public Schema AddTagField(string name, string separator = ",") public Schema AddTagField(string name, string separator = ",")
{ {
Fields.Add(new TagField(name, separator)); Fields.Add(new TagField(name, separator));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment