Unverified Commit 37e257f6 authored by oruchreis's avatar oruchreis Committed by GitHub

Added "Return" parameter to Query. (#1199)

* Added "Return" parameter to Query.

* Fixed api naming by JRediSearch, aslo added LimitKeys method
parent c7e76376
...@@ -143,6 +143,8 @@ public Paging(int offset, int count) ...@@ -143,6 +143,8 @@ public Paging(int offset, int count)
/// </summary> /// </summary>
public string Language { get; set; } public string Language { get; set; }
internal string[] _fields = null; internal string[] _fields = null;
internal string[] _keys = null;
internal string[] _returnFields = null;
/// <summary> /// <summary>
/// Set the query payload to be evaluated by the scoring function /// Set the query payload to be evaluated by the scoring function
/// </summary> /// </summary>
...@@ -210,6 +212,18 @@ internal void SerializeRedisArgs(List<object> args) ...@@ -210,6 +212,18 @@ internal void SerializeRedisArgs(List<object> args)
args.Add(_fields.Length.Boxed()); args.Add(_fields.Length.Boxed());
args.AddRange(_fields); args.AddRange(_fields);
} }
if (_keys?.Length > 0)
{
args.Add("INKEYS".Literal());
args.Add(_keys.Length.Boxed());
args.AddRange(_keys);
}
if (_returnFields?.Length > 0)
{
args.Add("RETURN".Literal());
args.Add(_returnFields.Length.Boxed());
args.AddRange(_returnFields);
}
if (SortBy != null) if (SortBy != null)
{ {
...@@ -323,6 +337,28 @@ public Query LimitFields(params string[] fields) ...@@ -323,6 +337,28 @@ public Query LimitFields(params string[] fields)
return this; return this;
} }
/// <summary>
/// Limit the query to results that are limited to a specific set of keys
/// </summary>
/// <param name="fields">fields a list of TEXT fields in the schemas</param>
/// <returns>the query object itself</returns>
public Query LimitKeys(params string[] keys)
{
_keys = keys;
return this;
}
/// <summary>
/// Result's projection - the fields to return by the query
/// </summary>
/// <param name="fields">fields a list of TEXT fields in the schemas</param>
/// <returns>the query object itself</returns>
public Query ReturnFields(params string[] fields)
{
_returnFields = fields;
return this;
}
public readonly struct HighlightTags public readonly struct HighlightTags
{ {
public HighlightTags(string open, string close) public HighlightTags(string open, string close)
......
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