Skip to content

Commit 3f582d1

Browse files
committed
feat(Discovery): add suggested query to query response
1 parent affd1f9 commit 3f582d1

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Scripts/Services/Discovery/V1/DiscoveryService.cs

+9-7
Original file line numberDiff line numberDiff line change
@@ -3274,20 +3274,22 @@ private void OnFederatedQueryNoticesResponse(RESTConnector.Request req, RESTConn
32743274
/// <param name="callback">The callback function that is invoked when the operation completes.</param>
32753275
/// <param name="environmentId">The ID of the environment.</param>
32763276
/// <param name="collectionId">The ID of the collection.</param>
3277+
/// <param name="prefix">The prefix to use for autocompletion. For example, the prefix `Ho` could autocomplete
3278+
/// to `Hot`, `Housing`, or `How do I upgrade`. Possible completions are.</param>
32773279
/// <param name="field">The field in the result documents that autocompletion suggestions are identified from.
32783280
/// (optional)</param>
3279-
/// <param name="prefix">The prefix to use for autocompletion. For example, the prefix `Ho` could autocomplete
3280-
/// to `Hot`, `Housing`, or `How do I upgrade`. Possible completions are. (optional)</param>
32813281
/// <param name="count">The number of autocompletion suggestions to return. (optional)</param>
32823282
/// <returns><see cref="Completions" />Completions</returns>
3283-
public bool GetAutocompletion(Callback<Completions> callback, string environmentId, string collectionId, string field = null, string prefix = null, long? count = null)
3283+
public bool GetAutocompletion(Callback<Completions> callback, string environmentId, string collectionId, string prefix, string field = null, long? count = null)
32843284
{
32853285
if (callback == null)
32863286
throw new ArgumentNullException("`callback` is required for `GetAutocompletion`");
32873287
if (string.IsNullOrEmpty(environmentId))
32883288
throw new ArgumentNullException("`environmentId` is required for `GetAutocompletion`");
32893289
if (string.IsNullOrEmpty(collectionId))
32903290
throw new ArgumentNullException("`collectionId` is required for `GetAutocompletion`");
3291+
if (string.IsNullOrEmpty(prefix))
3292+
throw new ArgumentNullException("`prefix` is required for `GetAutocompletion`");
32913293

32923294
RequestObject<Completions> req = new RequestObject<Completions>
32933295
{
@@ -3309,14 +3311,14 @@ public bool GetAutocompletion(Callback<Completions> callback, string environment
33093311
}
33103312

33113313
req.Parameters["version"] = VersionDate;
3312-
if (!string.IsNullOrEmpty(field))
3313-
{
3314-
req.Parameters["field"] = field;
3315-
}
33163314
if (!string.IsNullOrEmpty(prefix))
33173315
{
33183316
req.Parameters["prefix"] = prefix;
33193317
}
3318+
if (!string.IsNullOrEmpty(field))
3319+
{
3320+
req.Parameters["field"] = field;
3321+
}
33203322
if (count != null)
33213323
{
33223324
req.Parameters["count"] = count;

Scripts/Services/Discovery/V1/Model/QueryResponse.cs

+5
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,10 @@ public class QueryResponse
6363
/// </summary>
6464
[JsonProperty("retrieval_details", NullValueHandling = NullValueHandling.Ignore)]
6565
public RetrievalDetails RetrievalDetails { get; set; }
66+
/// <summary>
67+
/// The suggestions for a misspelled natural language query.
68+
/// </summary>
69+
[JsonProperty("suggested_query", NullValueHandling = NullValueHandling.Ignore)]
70+
public string SuggestedQuery { get; set; }
6671
}
6772
}

0 commit comments

Comments
 (0)