| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. See License.txt in the project root for |
| | | 3 | | // license information. |
| | | 4 | | |
| | | 5 | | namespace Microsoft.Azure.Search |
| | | 6 | | { |
| | | 7 | | using System.Collections.Generic; |
| | | 8 | | using System.Threading; |
| | | 9 | | using System.Threading.Tasks; |
| | | 10 | | using Microsoft.Azure.Search.Models; |
| | | 11 | | using Microsoft.Rest.Azure; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Operations for querying an index and uploading, merging, and deleting documents. |
| | | 15 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/Document-operations" /> |
| | | 16 | | /// </summary> |
| | | 17 | | public static class DocumentsOperationsExtensions |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// Queries the number of documents in the search index. |
| | | 21 | | /// </summary> |
| | | 22 | | /// <param name='operations'> |
| | | 23 | | /// The operations group for this extension method. |
| | | 24 | | /// </param> |
| | | 25 | | /// <param name='searchRequestOptions'> |
| | | 26 | | /// Additional parameters for the operation |
| | | 27 | | /// </param> |
| | | 28 | | public static long Count( |
| | | 29 | | this IDocumentsOperations operations, |
| | | 30 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 31 | | { |
| | 36 | 32 | | return operations.CountAsync(searchRequestOptions).GetAwaiter().GetResult(); |
| | | 33 | | } |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Queries the number of documents in the search index. |
| | | 37 | | /// </summary> |
| | | 38 | | /// <param name='operations'> |
| | | 39 | | /// The operations group for this extension method. |
| | | 40 | | /// </param> |
| | | 41 | | /// <param name='searchRequestOptions'> |
| | | 42 | | /// Additional parameters for the operation |
| | | 43 | | /// </param> |
| | | 44 | | /// <param name='cancellationToken'> |
| | | 45 | | /// The cancellation token. |
| | | 46 | | /// </param> |
| | | 47 | | public static async Task<long> CountAsync( |
| | | 48 | | this IDocumentsOperations operations, |
| | | 49 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 50 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 51 | | { |
| | 36 | 52 | | using (var _result = await operations.CountWithHttpMessagesAsync(searchRequestOptions, null, cancellationTok |
| | | 53 | | { |
| | 36 | 54 | | return _result.Body; |
| | | 55 | | } |
| | 36 | 56 | | } |
| | | 57 | | |
| | | 58 | | /// <summary> |
| | | 59 | | /// Queries the number of documents in the search index. |
| | | 60 | | /// </summary> |
| | | 61 | | /// <param name='operations'> |
| | | 62 | | /// The operations group for this extension method. |
| | | 63 | | /// </param> |
| | | 64 | | /// <param name='searchRequestOptions'> |
| | | 65 | | /// Additional parameters for the operation |
| | | 66 | | /// </param> |
| | | 67 | | public static AutocompleteResult Autocomplete( |
| | | 68 | | this IDocumentsOperations operations, |
| | | 69 | | string searchText, |
| | | 70 | | string suggesterName, |
| | | 71 | | AutocompleteParameters autocompleteParameters = null, |
| | | 72 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 73 | | { |
| | 76 | 74 | | return operations.AutocompleteAsync(searchText, suggesterName, autocompleteParameters, searchRequestOptions) |
| | | 75 | | } |
| | | 76 | | |
| | | 77 | | /// <summary> |
| | | 78 | | /// Queries the number of documents in the search index. |
| | | 79 | | /// </summary> |
| | | 80 | | /// <param name='operations'> |
| | | 81 | | /// The operations group for this extension method. |
| | | 82 | | /// </param> |
| | | 83 | | /// <param name='searchRequestOptions'> |
| | | 84 | | /// Additional parameters for the operation |
| | | 85 | | /// </param> |
| | | 86 | | /// <param name='cancellationToken'> |
| | | 87 | | /// The cancellation token. |
| | | 88 | | /// </param> |
| | | 89 | | public static async Task<AutocompleteResult> AutocompleteAsync( |
| | | 90 | | this IDocumentsOperations operations, |
| | | 91 | | string searchText, |
| | | 92 | | string suggesterName, |
| | | 93 | | AutocompleteParameters autocompleteParameters = null, |
| | | 94 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 95 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 96 | | { |
| | 76 | 97 | | using (var _result = await operations.AutocompleteWithHttpMessagesAsync(searchText, suggesterName, autocompl |
| | | 98 | | { |
| | 68 | 99 | | return _result.Body; |
| | | 100 | | } |
| | 68 | 101 | | } |
| | | 102 | | |
| | | 103 | | /// <summary> |
| | | 104 | | /// Retrieves the next page of search results from the search index. |
| | | 105 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/search-documents">Search Documents</see> |
| | | 106 | | /// </summary> |
| | | 107 | | /// <param name='operations'> |
| | | 108 | | /// The operations group for this extension method. |
| | | 109 | | /// </param> |
| | | 110 | | /// <param name="continuationToken"> |
| | | 111 | | /// Encapsulates the state required to fetch the next page of search results from the index. |
| | | 112 | | /// </param> |
| | | 113 | | /// <param name='searchRequestOptions'> |
| | | 114 | | /// Additional parameters for the operation |
| | | 115 | | /// </param> |
| | | 116 | | /// <returns> |
| | | 117 | | /// Response containing the documents matching the query. |
| | | 118 | | /// </returns> |
| | | 119 | | /// <remarks> |
| | | 120 | | /// <para> |
| | | 121 | | /// The non-generic overloads of the ContinueSearch, ContinueSearchAsync, and |
| | | 122 | | /// ContinueSearchWithHttpMessagesAsync methods make a best-effort attempt to map JSON types in the response |
| | | 123 | | /// payload to .NET types. See |
| | | 124 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync(string, System.Collections.Generic.IEnumerable<s |
| | | 125 | | /// for more information. |
| | | 126 | | /// </para> |
| | | 127 | | /// <para> |
| | | 128 | | /// If Azure Cognitive Search can't include all results in a single response, the response returned will include |
| | | 129 | | /// continuation token that can be passed to ContinueSearch to retrieve more results. |
| | | 130 | | /// See <c cref="DocumentSearchResult<T>.ContinuationToken">DocumentSearchResult.ContinuationToken</c> |
| | | 131 | | /// for more information. |
| | | 132 | | /// </para> |
| | | 133 | | /// <para> |
| | | 134 | | /// Note that this method is not meant to help you implement paging of search results. You can implement |
| | | 135 | | /// paging using the <c cref="SearchParameters.Top">Top</c> and <c cref="SearchParameters.Skip">Skip</c> |
| | | 136 | | /// parameters to the |
| | | 137 | | /// <c cref="IDocumentsOperations.SearchWithHttpMessagesAsync<T>(string, SearchParameters, SearchRequestOp |
| | | 138 | | /// method. |
| | | 139 | | /// </para> |
| | | 140 | | /// </remarks> |
| | | 141 | | public static DocumentSearchResult<Document> ContinueSearch( |
| | | 142 | | this IDocumentsOperations operations, |
| | | 143 | | SearchContinuationToken continuationToken, |
| | | 144 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 145 | | { |
| | 12 | 146 | | return operations.ContinueSearchAsync(continuationToken, searchRequestOptions).GetAwaiter().GetResult(); |
| | | 147 | | } |
| | | 148 | | |
| | | 149 | | /// <summary> |
| | | 150 | | /// Retrieves the next page of search results from the search index. |
| | | 151 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/search-documents">Search Documents</see> |
| | | 152 | | /// </summary> |
| | | 153 | | /// <param name='operations'> |
| | | 154 | | /// The operations group for this extension method. |
| | | 155 | | /// </param> |
| | | 156 | | /// <param name="continuationToken"> |
| | | 157 | | /// Encapsulates the state required to fetch the next page of search results from the index. |
| | | 158 | | /// </param> |
| | | 159 | | /// <param name='searchRequestOptions'> |
| | | 160 | | /// Additional parameters for the operation |
| | | 161 | | /// </param> |
| | | 162 | | /// <param name='cancellationToken'> |
| | | 163 | | /// The cancellation token. |
| | | 164 | | /// </param> |
| | | 165 | | /// <returns> |
| | | 166 | | /// Response containing the documents matching the query. |
| | | 167 | | /// </returns> |
| | | 168 | | /// <remarks> |
| | | 169 | | /// <para> |
| | | 170 | | /// The non-generic overloads of the ContinueSearch, ContinueSearchAsync, and |
| | | 171 | | /// ContinueSearchWithHttpMessagesAsync methods make a best-effort attempt to map JSON types in the response |
| | | 172 | | /// payload to .NET types. See |
| | | 173 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync(string, System.Collections.Generic.IEnumerable<s |
| | | 174 | | /// for more information. |
| | | 175 | | /// </para> |
| | | 176 | | /// <para> |
| | | 177 | | /// If Azure Cognitive Search can't include all results in a single response, the response returned will include |
| | | 178 | | /// continuation token that can be passed to ContinueSearch to retrieve more results. |
| | | 179 | | /// See <c cref="DocumentSearchResult<T>.ContinuationToken">DocumentSearchResult.ContinuationToken</c> |
| | | 180 | | /// for more information. |
| | | 181 | | /// </para> |
| | | 182 | | /// <para> |
| | | 183 | | /// Note that this method is not meant to help you implement paging of search results. You can implement |
| | | 184 | | /// paging using the <c cref="SearchParameters.Top">Top</c> and <c cref="SearchParameters.Skip">Skip</c> |
| | | 185 | | /// parameters to the |
| | | 186 | | /// <c cref="IDocumentsOperations.SearchWithHttpMessagesAsync<T>(string, SearchParameters, SearchRequestOp |
| | | 187 | | /// method. |
| | | 188 | | /// </para> |
| | | 189 | | /// </remarks> |
| | | 190 | | public static async Task<DocumentSearchResult<Document>> ContinueSearchAsync( |
| | | 191 | | this IDocumentsOperations operations, |
| | | 192 | | SearchContinuationToken continuationToken, |
| | | 193 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 194 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 195 | | { |
| | 12 | 196 | | AzureOperationResponse<DocumentSearchResult<Document>> result = await operations.ContinueSearchWithHttpMessa |
| | 12 | 197 | | return result.Body; |
| | 12 | 198 | | } |
| | | 199 | | |
| | | 200 | | /// <summary> |
| | | 201 | | /// Retrieves the next page of search results from the search index. |
| | | 202 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/search-documents">Search Documents</see> |
| | | 203 | | /// </summary> |
| | | 204 | | /// <typeparam name="T"> |
| | | 205 | | /// The CLR type that maps to the index schema. Instances of this type can be retrieved as documents |
| | | 206 | | /// from the index. |
| | | 207 | | /// </typeparam> |
| | | 208 | | /// <param name='operations'> |
| | | 209 | | /// The operations group for this extension method. |
| | | 210 | | /// </param> |
| | | 211 | | /// <param name="continuationToken"> |
| | | 212 | | /// Encapsulates the state required to fetch the next page of search results from the index. |
| | | 213 | | /// </param> |
| | | 214 | | /// <param name='searchRequestOptions'> |
| | | 215 | | /// Additional parameters for the operation |
| | | 216 | | /// </param> |
| | | 217 | | /// <returns> |
| | | 218 | | /// Response containing the documents matching the query. |
| | | 219 | | /// </returns> |
| | | 220 | | /// <remarks> |
| | | 221 | | /// <para> |
| | | 222 | | /// The generic overloads of the ContinueSearch, ContinueSearchAsync, and ContinueSearchWithHttpMessagesAsync |
| | | 223 | | /// methods support mapping of search field types to .NET types via the type parameter T. See |
| | | 224 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync<T>(string, System.Collections.Generic.IEnumer |
| | | 225 | | /// for more details on the type mapping. |
| | | 226 | | /// </para> |
| | | 227 | | /// <para> |
| | | 228 | | /// If Azure Cognitive Search can't include all results in a single response, the response returned will include |
| | | 229 | | /// continuation token that can be passed to ContinueSearch to retrieve more results. |
| | | 230 | | /// See <c cref="DocumentSearchResult<T>.ContinuationToken">DocumentSearchResult.ContinuationToken</c> |
| | | 231 | | /// for more information. |
| | | 232 | | /// </para> |
| | | 233 | | /// <para> |
| | | 234 | | /// Note that this method is not meant to help you implement paging of search results. You can implement |
| | | 235 | | /// paging using the <c cref="SearchParameters.Top">Top</c> and <c cref="SearchParameters.Skip">Skip</c> |
| | | 236 | | /// parameters to the |
| | | 237 | | /// <c cref="IDocumentsOperations.SearchWithHttpMessagesAsync<T>(string, SearchParameters, SearchRequestOp |
| | | 238 | | /// method. |
| | | 239 | | /// </para> |
| | | 240 | | /// </remarks> |
| | | 241 | | public static DocumentSearchResult<T> ContinueSearch<T>( |
| | | 242 | | this IDocumentsOperations operations, |
| | | 243 | | SearchContinuationToken continuationToken, |
| | | 244 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 245 | | { |
| | 20 | 246 | | return operations.ContinueSearchAsync<T>(continuationToken, searchRequestOptions).GetAwaiter().GetResult(); |
| | | 247 | | } |
| | | 248 | | |
| | | 249 | | /// <summary> |
| | | 250 | | /// Retrieves the next page of search results from the search index. |
| | | 251 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/search-documents">Search Documents</see> |
| | | 252 | | /// </summary> |
| | | 253 | | /// <typeparam name="T"> |
| | | 254 | | /// The CLR type that maps to the index schema. Instances of this type can be retrieved as documents |
| | | 255 | | /// from the index. |
| | | 256 | | /// </typeparam> |
| | | 257 | | /// <param name='operations'> |
| | | 258 | | /// The operations group for this extension method. |
| | | 259 | | /// </param> |
| | | 260 | | /// <param name="continuationToken"> |
| | | 261 | | /// Encapsulates the state required to fetch the next page of search results from the index. |
| | | 262 | | /// </param> |
| | | 263 | | /// <param name='searchRequestOptions'> |
| | | 264 | | /// Additional parameters for the operation |
| | | 265 | | /// </param> |
| | | 266 | | /// <param name='cancellationToken'> |
| | | 267 | | /// The cancellation token. |
| | | 268 | | /// </param> |
| | | 269 | | /// <returns> |
| | | 270 | | /// Response containing the documents matching the query. |
| | | 271 | | /// </returns> |
| | | 272 | | /// <remarks> |
| | | 273 | | /// <para> |
| | | 274 | | /// The generic overloads of the ContinueSearch, ContinueSearchAsync, and ContinueSearchWithHttpMessagesAsync |
| | | 275 | | /// methods support mapping of search field types to .NET types via the type parameter T. See |
| | | 276 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync<T>(string, System.Collections.Generic.IEnumer |
| | | 277 | | /// for more details on the type mapping. |
| | | 278 | | /// </para> |
| | | 279 | | /// <para> |
| | | 280 | | /// If Azure Cognitive Search can't include all results in a single response, the response returned will include |
| | | 281 | | /// continuation token that can be passed to ContinueSearch to retrieve more results. |
| | | 282 | | /// See <c cref="DocumentSearchResult<T>.ContinuationToken">DocumentSearchResult.ContinuationToken</c> |
| | | 283 | | /// for more information. |
| | | 284 | | /// </para> |
| | | 285 | | /// <para> |
| | | 286 | | /// Note that this method is not meant to help you implement paging of search results. You can implement |
| | | 287 | | /// paging using the <c cref="SearchParameters.Top">Top</c> and <c cref="SearchParameters.Skip">Skip</c> |
| | | 288 | | /// parameters to the |
| | | 289 | | /// <c cref="IDocumentsOperations.SearchWithHttpMessagesAsync<T>(string, SearchParameters, SearchRequestOp |
| | | 290 | | /// method. |
| | | 291 | | /// </para> |
| | | 292 | | /// </remarks> |
| | | 293 | | public static async Task<DocumentSearchResult<T>> ContinueSearchAsync<T>( |
| | | 294 | | this IDocumentsOperations operations, |
| | | 295 | | SearchContinuationToken continuationToken, |
| | | 296 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 297 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 298 | | { |
| | 20 | 299 | | AzureOperationResponse<DocumentSearchResult<T>> result = await operations.ContinueSearchWithHttpMessagesAsyn |
| | 20 | 300 | | return result.Body; |
| | 20 | 301 | | } |
| | | 302 | | |
| | | 303 | | /// <summary> |
| | | 304 | | /// Retrieves a document from the search index. |
| | | 305 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/lookup-document">Lookup Document</see> |
| | | 306 | | /// </summary> |
| | | 307 | | /// <param name='operations'> |
| | | 308 | | /// The operations group for this extension method. |
| | | 309 | | /// </param> |
| | | 310 | | /// <param name="key"> |
| | | 311 | | /// The key of the document to retrieve; See |
| | | 312 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/naming-rules">Naming rules</see> for the rules |
| | | 313 | | /// document keys. |
| | | 314 | | /// </param> |
| | | 315 | | /// <param name="selectedFields"> |
| | | 316 | | /// List of field names to retrieve for the document; Any field not retrieved will be missing from the |
| | | 317 | | /// returned document. All retrievable fields are included in the result by default. |
| | | 318 | | /// </param> |
| | | 319 | | /// <param name='searchRequestOptions'> |
| | | 320 | | /// Additional parameters for the operation |
| | | 321 | | /// </param> |
| | | 322 | | /// <returns> |
| | | 323 | | /// The requested document. |
| | | 324 | | /// </returns> |
| | | 325 | | /// <remarks> |
| | | 326 | | /// The non-generic overloads of the Get, GetAsync, and GetWithHttpMessagesAsync methods make a best-effort |
| | | 327 | | /// attempt to map JSON types in the response payload to .NET types. See |
| | | 328 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync(string, System.Collections.Generic.IEnumerable<s |
| | | 329 | | /// for more information. |
| | | 330 | | /// </remarks> |
| | | 331 | | public static Document Get( |
| | | 332 | | this IDocumentsOperations operations, |
| | | 333 | | string key, |
| | | 334 | | IEnumerable<string> selectedFields = null, |
| | | 335 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 336 | | { |
| | 34 | 337 | | return operations.GetAsync(key, selectedFields, searchRequestOptions).GetAwaiter().GetResult(); |
| | | 338 | | } |
| | | 339 | | |
| | | 340 | | /// <summary> |
| | | 341 | | /// Retrieves a document from the search index. |
| | | 342 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/lookup-document">Lookup Document</see> |
| | | 343 | | /// </summary> |
| | | 344 | | /// <param name='operations'> |
| | | 345 | | /// The operations group for this extension method. |
| | | 346 | | /// </param> |
| | | 347 | | /// <param name="key"> |
| | | 348 | | /// The key of the document to retrieve; See |
| | | 349 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/naming-rules">Naming rules</see> for the rules |
| | | 350 | | /// document keys. |
| | | 351 | | /// </param> |
| | | 352 | | /// <param name="selectedFields"> |
| | | 353 | | /// List of field names to retrieve for the document; Any field not retrieved will be missing from the |
| | | 354 | | /// returned document. |
| | | 355 | | /// </param> |
| | | 356 | | /// <param name='searchRequestOptions'> |
| | | 357 | | /// Additional parameters for the operation |
| | | 358 | | /// </param> |
| | | 359 | | /// <param name='cancellationToken'> |
| | | 360 | | /// The cancellation token. |
| | | 361 | | /// </param> |
| | | 362 | | /// <returns> |
| | | 363 | | /// The requested document. |
| | | 364 | | /// </returns> |
| | | 365 | | /// <remarks> |
| | | 366 | | /// The non-generic overloads of the Get, GetAsync, and GetWithHttpMessagesAsync methods make a best-effort |
| | | 367 | | /// attempt to map JSON types in the response payload to .NET types. See |
| | | 368 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync(string, System.Collections.Generic.IEnumerable<s |
| | | 369 | | /// for more information. |
| | | 370 | | /// </remarks> |
| | | 371 | | public static async Task<Document> GetAsync( |
| | | 372 | | this IDocumentsOperations operations, |
| | | 373 | | string key, |
| | | 374 | | IEnumerable<string> selectedFields = null, |
| | | 375 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 376 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 377 | | { |
| | 34 | 378 | | AzureOperationResponse<Document> result = await operations.GetWithHttpMessagesAsync(key, selectedFields ?? D |
| | 30 | 379 | | return result.Body; |
| | 30 | 380 | | } |
| | | 381 | | |
| | | 382 | | /// <summary> |
| | | 383 | | /// Retrieves a document from the search index. |
| | | 384 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/lookup-document">Lookup Document</see> |
| | | 385 | | /// </summary> |
| | | 386 | | /// <typeparam name="T"> |
| | | 387 | | /// The CLR type that maps to the index schema. Instances of this type can be retrieved as documents |
| | | 388 | | /// from the index. |
| | | 389 | | /// </typeparam> |
| | | 390 | | /// <param name='operations'> |
| | | 391 | | /// The operations group for this extension method. |
| | | 392 | | /// </param> |
| | | 393 | | /// <param name="key"> |
| | | 394 | | /// The key of the document to retrieve; See |
| | | 395 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/naming-rules">Naming rules</see> for the rules |
| | | 396 | | /// document keys. |
| | | 397 | | /// </param> |
| | | 398 | | /// <param name="selectedFields"> |
| | | 399 | | /// List of field names to retrieve for the document; Any field not retrieved will have null or default as its |
| | | 400 | | /// corresponding property value in the returned object. All retrievable fields are included in the result by |
| | | 401 | | /// default. |
| | | 402 | | /// </param> |
| | | 403 | | /// <param name='searchRequestOptions'> |
| | | 404 | | /// Additional parameters for the operation |
| | | 405 | | /// </param> |
| | | 406 | | /// <returns> |
| | | 407 | | /// The requested document. |
| | | 408 | | /// </returns> |
| | | 409 | | /// <remarks> |
| | | 410 | | /// The generic overloads of the Get, GetAsync, and GetWithHttpMessagesAsync methods support mapping of Azure |
| | | 411 | | /// Search field types to .NET types via the type parameter T. See |
| | | 412 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync<T>(string, System.Collections.Generic.IEnumer |
| | | 413 | | /// for more details on the type mapping. |
| | | 414 | | /// </remarks> |
| | | 415 | | public static T Get<T>( |
| | | 416 | | this IDocumentsOperations operations, |
| | | 417 | | string key, |
| | | 418 | | IEnumerable<string> selectedFields = null, |
| | | 419 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 420 | | { |
| | 46 | 421 | | return operations.GetAsync<T>(key, selectedFields, searchRequestOptions).GetAwaiter().GetResult(); |
| | | 422 | | } |
| | | 423 | | |
| | | 424 | | /// <summary> |
| | | 425 | | /// Retrieves a document from the search index. |
| | | 426 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/lookup-document">Lookup Document</see> |
| | | 427 | | /// </summary> |
| | | 428 | | /// <typeparam name="T"> |
| | | 429 | | /// The CLR type that maps to the index schema. Instances of this type can be retrieved as documents |
| | | 430 | | /// from the index. |
| | | 431 | | /// </typeparam> |
| | | 432 | | /// <param name='operations'> |
| | | 433 | | /// The operations group for this extension method. |
| | | 434 | | /// </param> |
| | | 435 | | /// <param name="key"> |
| | | 436 | | /// The key of the document to retrieve; See |
| | | 437 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/naming-rules">Naming rules</see> for the rules |
| | | 438 | | /// document keys. |
| | | 439 | | /// </param> |
| | | 440 | | /// <param name="selectedFields"> |
| | | 441 | | /// List of field names to retrieve for the document; Any field not retrieved will have null or default as its |
| | | 442 | | /// corresponding property value in the returned object. All retrievable fields are included in the result by |
| | | 443 | | /// default. |
| | | 444 | | /// </param> |
| | | 445 | | /// <param name='searchRequestOptions'> |
| | | 446 | | /// Additional parameters for the operation |
| | | 447 | | /// </param> |
| | | 448 | | /// <param name='cancellationToken'> |
| | | 449 | | /// The cancellation token. |
| | | 450 | | /// </param> |
| | | 451 | | /// <returns> |
| | | 452 | | /// The requested document. |
| | | 453 | | /// </returns> |
| | | 454 | | /// <remarks> |
| | | 455 | | /// The generic overloads of the Get, GetAsync, and GetWithHttpMessagesAsync methods support mapping of Azure |
| | | 456 | | /// Search field types to .NET types via the type parameter T. See |
| | | 457 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync<T>(string, System.Collections.Generic.IEnumer |
| | | 458 | | /// for more details on the type mapping. |
| | | 459 | | /// </remarks> |
| | | 460 | | public static async Task<T> GetAsync<T>( |
| | | 461 | | this IDocumentsOperations operations, |
| | | 462 | | string key, |
| | | 463 | | IEnumerable<string> selectedFields = null, |
| | | 464 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 465 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 466 | | { |
| | 46 | 467 | | AzureOperationResponse<T> result = await operations.GetWithHttpMessagesAsync<T>(key, selectedFields ?? Docum |
| | 46 | 468 | | return result.Body; |
| | 46 | 469 | | } |
| | | 470 | | |
| | | 471 | | /// <summary> |
| | | 472 | | /// Sends a batch of upload, merge, and/or delete actions to the search index. |
| | | 473 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents">Add, Update or D |
| | | 474 | | /// </summary> |
| | | 475 | | /// <param name='operations'> |
| | | 476 | | /// The operations group for this extension method. |
| | | 477 | | /// </param> |
| | | 478 | | /// <param name="batch"> |
| | | 479 | | /// The batch of index actions. |
| | | 480 | | /// </param> |
| | | 481 | | /// <param name='searchRequestOptions'> |
| | | 482 | | /// Additional parameters for the operation |
| | | 483 | | /// </param> |
| | | 484 | | /// <exception cref="IndexBatchException"> |
| | | 485 | | /// Thrown when some of the indexing actions failed, but other actions succeeded and modified the state of |
| | | 486 | | /// the index. This can happen when the Search Service is under heavy indexing load. It is important to |
| | | 487 | | /// explicitly catch this exception and check its |
| | | 488 | | /// <c cref="IndexBatchException.IndexingResults">IndexResult</c> property. This property reports the status |
| | | 489 | | /// of each indexing action in the batch, making it possible to determine the state of the index after a |
| | | 490 | | /// partial failure. |
| | | 491 | | /// </exception> |
| | | 492 | | /// <remarks> |
| | | 493 | | /// The non-generic overloads of the Index, IndexAsync, and IndexWithHttpMessagesAsync methods make a |
| | | 494 | | /// best-effort attempt to map JSON types in the response payload to .NET types. See |
| | | 495 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync(string, System.Collections.Generic.IEnumerable<s |
| | | 496 | | /// for more information. |
| | | 497 | | /// </remarks> |
| | | 498 | | /// <returns> |
| | | 499 | | /// Response containing the status of operations for all actions in the batch. |
| | | 500 | | /// </returns> |
| | | 501 | | public static DocumentIndexResult Index( |
| | | 502 | | this IDocumentsOperations operations, |
| | | 503 | | IndexBatch<Document> batch, |
| | | 504 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 505 | | { |
| | 40 | 506 | | return operations.IndexAsync(batch, searchRequestOptions).GetAwaiter().GetResult(); |
| | | 507 | | } |
| | | 508 | | |
| | | 509 | | /// <summary> |
| | | 510 | | /// Sends a batch of upload, merge, and/or delete actions to the search index. |
| | | 511 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents">Add, Update or D |
| | | 512 | | /// </summary> |
| | | 513 | | /// <param name='operations'> |
| | | 514 | | /// The operations group for this extension method. |
| | | 515 | | /// </param> |
| | | 516 | | /// <param name="batch"> |
| | | 517 | | /// The batch of index actions. |
| | | 518 | | /// </param> |
| | | 519 | | /// <param name='searchRequestOptions'> |
| | | 520 | | /// Additional parameters for the operation |
| | | 521 | | /// </param> |
| | | 522 | | /// <param name='cancellationToken'> |
| | | 523 | | /// The cancellation token. |
| | | 524 | | /// </param> |
| | | 525 | | /// <exception cref="IndexBatchException"> |
| | | 526 | | /// Thrown when some of the indexing actions failed, but other actions succeeded and modified the state of |
| | | 527 | | /// the index. This can happen when the Search Service is under heavy indexing load. It is important to |
| | | 528 | | /// explicitly catch this exception and check its |
| | | 529 | | /// <c cref="IndexBatchException.IndexingResults">IndexResult</c> property. This property reports the status |
| | | 530 | | /// of each indexing action in the batch, making it possible to determine the state of the index after a |
| | | 531 | | /// partial failure. |
| | | 532 | | /// </exception> |
| | | 533 | | /// <remarks> |
| | | 534 | | /// The non-generic overloads of the Index, IndexAsync, and IndexWithHttpMessagesAsync methods make a |
| | | 535 | | /// best-effort attempt to map JSON types in the response payload to .NET types. See |
| | | 536 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync(string, System.Collections.Generic.IEnumerable<s |
| | | 537 | | /// for more information. |
| | | 538 | | /// </remarks> |
| | | 539 | | /// <returns> |
| | | 540 | | /// Response containing the status of operations for all actions in the batch. |
| | | 541 | | /// </returns> |
| | | 542 | | public static async Task<DocumentIndexResult> IndexAsync( |
| | | 543 | | this IDocumentsOperations operations, |
| | | 544 | | IndexBatch<Document> batch, |
| | | 545 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 546 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 547 | | { |
| | 40 | 548 | | AzureOperationResponse<DocumentIndexResult> result = await operations.IndexWithHttpMessagesAsync(batch, sear |
| | 36 | 549 | | return result.Body; |
| | 36 | 550 | | } |
| | | 551 | | |
| | | 552 | | /// <summary> |
| | | 553 | | /// Sends a batch of upload, merge, and/or delete actions to the search index. |
| | | 554 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents">Add, Update or D |
| | | 555 | | /// </summary> |
| | | 556 | | /// <typeparam name="T"> |
| | | 557 | | /// The CLR type that maps to the index schema. Instances of this type can be stored as documents in the index. |
| | | 558 | | /// </typeparam> |
| | | 559 | | /// <param name='operations'> |
| | | 560 | | /// The operations group for this extension method. |
| | | 561 | | /// </param> |
| | | 562 | | /// <param name="batch"> |
| | | 563 | | /// The batch of index actions. |
| | | 564 | | /// </param> |
| | | 565 | | /// <param name='searchRequestOptions'> |
| | | 566 | | /// Additional parameters for the operation |
| | | 567 | | /// </param> |
| | | 568 | | /// <exception cref="IndexBatchException"> |
| | | 569 | | /// Thrown when some of the indexing actions failed, but other actions succeeded and modified the state of |
| | | 570 | | /// the index. This can happen when the Search Service is under heavy indexing load. It is important to |
| | | 571 | | /// explicitly catch this exception and check its |
| | | 572 | | /// <c cref="IndexBatchException.IndexingResults">IndexResult</c> property. This property reports the status |
| | | 573 | | /// of each indexing action in the batch, making it possible to determine the state of the index after a |
| | | 574 | | /// partial failure. |
| | | 575 | | /// </exception> |
| | | 576 | | /// <returns> |
| | | 577 | | /// Response containing the status of operations for all actions in the batch. |
| | | 578 | | /// </returns> |
| | | 579 | | /// <remarks> |
| | | 580 | | /// The generic overloads of the Index and IndexAsync methods support mapping of search field types to |
| | | 581 | | /// .NET types via the type parameter T. See |
| | | 582 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync<T>(string, System.Collections.Generic.IEnumer |
| | | 583 | | /// for more details on the type mapping. |
| | | 584 | | /// </remarks> |
| | | 585 | | public static DocumentIndexResult Index<T>( |
| | | 586 | | this IDocumentsOperations operations, |
| | | 587 | | IndexBatch<T> batch, |
| | | 588 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 589 | | { |
| | 406 | 590 | | return operations.IndexAsync<T>(batch, searchRequestOptions).GetAwaiter().GetResult(); |
| | | 591 | | } |
| | | 592 | | |
| | | 593 | | /// <summary> |
| | | 594 | | /// Sends a batch of upload, merge, and/or delete actions to the search index. |
| | | 595 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents">Add, Update or D |
| | | 596 | | /// </summary> |
| | | 597 | | /// <typeparam name="T"> |
| | | 598 | | /// The CLR type that maps to the index schema. Instances of this type can be stored as documents in the index. |
| | | 599 | | /// </typeparam> |
| | | 600 | | /// <param name='operations'> |
| | | 601 | | /// The operations group for this extension method. |
| | | 602 | | /// </param> |
| | | 603 | | /// <param name="batch"> |
| | | 604 | | /// The batch of index actions. |
| | | 605 | | /// </param> |
| | | 606 | | /// <param name='searchRequestOptions'> |
| | | 607 | | /// Additional parameters for the operation |
| | | 608 | | /// </param> |
| | | 609 | | /// <param name='cancellationToken'> |
| | | 610 | | /// The cancellation token. |
| | | 611 | | /// </param> |
| | | 612 | | /// <exception cref="IndexBatchException"> |
| | | 613 | | /// Thrown when some of the indexing actions failed, but other actions succeeded and modified the state of |
| | | 614 | | /// the index. This can happen when the Search Service is under heavy indexing load. It is important to |
| | | 615 | | /// explicitly catch this exception and check its |
| | | 616 | | /// <c cref="IndexBatchException.IndexingResults">IndexResult</c> property. This property reports the status |
| | | 617 | | /// of each indexing action in the batch, making it possible to determine the state of the index after a |
| | | 618 | | /// partial failure. |
| | | 619 | | /// </exception> |
| | | 620 | | /// <returns> |
| | | 621 | | /// Response containing the status of operations for all actions in the batch. |
| | | 622 | | /// </returns> |
| | | 623 | | /// <remarks> |
| | | 624 | | /// The generic overloads of the Index and IndexAsync methods support mapping of search field types to |
| | | 625 | | /// .NET types via the type parameter T. See |
| | | 626 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync<T>(string, System.Collections.Generic.IEnumer |
| | | 627 | | /// for more details on the type mapping. |
| | | 628 | | /// </remarks> |
| | | 629 | | public static async Task<DocumentIndexResult> IndexAsync<T>( |
| | | 630 | | this IDocumentsOperations operations, |
| | | 631 | | IndexBatch<T> batch, |
| | | 632 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 633 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 634 | | { |
| | 406 | 635 | | AzureOperationResponse<DocumentIndexResult> result = await operations.IndexWithHttpMessagesAsync<T>(batch, s |
| | 400 | 636 | | return result.Body; |
| | 400 | 637 | | } |
| | | 638 | | |
| | | 639 | | /// <summary> |
| | | 640 | | /// Searches for documents in the search index. |
| | | 641 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/search-documents">Search Documents</see> |
| | | 642 | | /// </summary> |
| | | 643 | | /// <param name='operations'> |
| | | 644 | | /// The operations group for this extension method. |
| | | 645 | | /// </param> |
| | | 646 | | /// <param name="searchText"> |
| | | 647 | | /// A full-text search query expression; Use null or "*" to match all documents. See |
| | | 648 | | /// <see href="https://docs.microsoft.com/azure/search/query-simple-syntax">Simple query syntax in Azure Cogniti |
| | | 649 | | /// query syntax. |
| | | 650 | | /// </param> |
| | | 651 | | /// <param name="searchParameters"> |
| | | 652 | | /// Parameters to further refine the search query. |
| | | 653 | | /// </param> |
| | | 654 | | /// <param name='searchRequestOptions'> |
| | | 655 | | /// Additional parameters for the operation |
| | | 656 | | /// </param> |
| | | 657 | | /// <returns> |
| | | 658 | | /// Response containing the documents matching the query. |
| | | 659 | | /// </returns> |
| | | 660 | | /// <remarks> |
| | | 661 | | /// <para> |
| | | 662 | | /// The non-generic overloads of the Search, SearchAsync, and SearchWithHttpMessagesAsync methods make a |
| | | 663 | | /// best-effort attempt to map JSON types in the response payload to .NET types. See |
| | | 664 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync(string, System.Collections.Generic.IEnumerable<s |
| | | 665 | | /// for more information. |
| | | 666 | | /// </para> |
| | | 667 | | /// <para> |
| | | 668 | | /// If Azure Cognitive Search can't include all results in a single response, the response returned will include |
| | | 669 | | /// continuation token that can be passed to ContinueSearch to retrieve more results. |
| | | 670 | | /// See <c cref="DocumentSearchResult<T>.ContinuationToken">DocumentSearchResult.ContinuationToken</c> |
| | | 671 | | /// for more information. |
| | | 672 | | /// </para> |
| | | 673 | | /// </remarks> |
| | | 674 | | public static DocumentSearchResult<Document> Search( |
| | | 675 | | this IDocumentsOperations operations, |
| | | 676 | | string searchText, |
| | | 677 | | SearchParameters searchParameters = null, |
| | | 678 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 679 | | { |
| | 30 | 680 | | return operations.SearchAsync(searchText, searchParameters, searchRequestOptions).GetAwaiter().GetResult(); |
| | | 681 | | } |
| | | 682 | | |
| | | 683 | | /// <summary> |
| | | 684 | | /// Searches for documents in the search index. |
| | | 685 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/search-documents">Search Documents</see> |
| | | 686 | | /// </summary> |
| | | 687 | | /// <param name='operations'> |
| | | 688 | | /// The operations group for this extension method. |
| | | 689 | | /// </param> |
| | | 690 | | /// <param name="searchText"> |
| | | 691 | | /// A full-text search query expression; Use null or "*" to match all documents. See |
| | | 692 | | /// <see href="https://docs.microsoft.com/azure/search/query-simple-syntax">Simple query syntax in Azure Cogniti |
| | | 693 | | /// query syntax. |
| | | 694 | | /// </param> |
| | | 695 | | /// <param name="searchParameters"> |
| | | 696 | | /// Parameters to further refine the search query. |
| | | 697 | | /// </param> |
| | | 698 | | /// <param name='searchRequestOptions'> |
| | | 699 | | /// Additional parameters for the operation |
| | | 700 | | /// </param> |
| | | 701 | | /// <param name='cancellationToken'> |
| | | 702 | | /// The cancellation token. |
| | | 703 | | /// </param> |
| | | 704 | | /// <returns> |
| | | 705 | | /// Response containing the documents matching the query. |
| | | 706 | | /// </returns> |
| | | 707 | | /// <remarks> |
| | | 708 | | /// <para> |
| | | 709 | | /// The non-generic overloads of the Search, SearchAsync, and SearchWithHttpMessagesAsync methods make a |
| | | 710 | | /// best-effort attempt to map JSON types in the response payload to .NET types. See |
| | | 711 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync(string, System.Collections.Generic.IEnumerable<s |
| | | 712 | | /// for more information. |
| | | 713 | | /// </para> |
| | | 714 | | /// <para> |
| | | 715 | | /// If Azure Cognitive Search can't include all results in a single response, the response returned will include |
| | | 716 | | /// continuation token that can be passed to ContinueSearch to retrieve more results. |
| | | 717 | | /// See <c cref="DocumentSearchResult<T>.ContinuationToken">DocumentSearchResult.ContinuationToken</c> |
| | | 718 | | /// for more information. |
| | | 719 | | /// </para> |
| | | 720 | | /// </remarks> |
| | | 721 | | public static async Task<DocumentSearchResult<Document>> SearchAsync( |
| | | 722 | | this IDocumentsOperations operations, |
| | | 723 | | string searchText, |
| | | 724 | | SearchParameters searchParameters = null, |
| | | 725 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 726 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 727 | | { |
| | 30 | 728 | | AzureOperationResponse<DocumentSearchResult<Document>> result = await operations.SearchWithHttpMessagesAsync |
| | 22 | 729 | | return result.Body; |
| | 22 | 730 | | } |
| | | 731 | | |
| | | 732 | | /// <summary> |
| | | 733 | | /// Searches for documents in the search index. |
| | | 734 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/search-documents">Search Documents</see> |
| | | 735 | | /// </summary> |
| | | 736 | | /// <typeparam name="T"> |
| | | 737 | | /// The CLR type that maps to the index schema. Instances of this type can be retrieved as documents |
| | | 738 | | /// from the index. |
| | | 739 | | /// </typeparam> |
| | | 740 | | /// <param name='operations'> |
| | | 741 | | /// The operations group for this extension method. |
| | | 742 | | /// </param> |
| | | 743 | | /// <param name="searchText"> |
| | | 744 | | /// A full-text search query expression; Use null or "*" to match all documents. See |
| | | 745 | | /// <see href="https://docs.microsoft.com/azure/search/query-simple-syntax">Simple query syntax in Azure Cogniti |
| | | 746 | | /// query syntax. |
| | | 747 | | /// </param> |
| | | 748 | | /// <param name="searchParameters"> |
| | | 749 | | /// Parameters to further refine the search query. |
| | | 750 | | /// </param> |
| | | 751 | | /// <param name='searchRequestOptions'> |
| | | 752 | | /// Additional parameters for the operation |
| | | 753 | | /// </param> |
| | | 754 | | /// <returns> |
| | | 755 | | /// Response containing the documents matching the query. |
| | | 756 | | /// </returns> |
| | | 757 | | /// <remarks> |
| | | 758 | | /// <para> |
| | | 759 | | /// The generic overloads of the Search, SearchAsync, and SearchWithHttpMessagesAsync methods support mapping |
| | | 760 | | /// of search field types to .NET types via the type parameter T. See |
| | | 761 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync<T>(string, System.Collections.Generic.IEnumer |
| | | 762 | | /// for more details on the type mapping. |
| | | 763 | | /// </para> |
| | | 764 | | /// <para> |
| | | 765 | | /// If Azure Cognitive Search can't include all results in a single response, the response returned will include |
| | | 766 | | /// continuation token that can be passed to ContinueSearch to retrieve more results. |
| | | 767 | | /// See <c cref="DocumentSearchResult<T>.ContinuationToken">DocumentSearchResult.ContinuationToken</c> |
| | | 768 | | /// for more information. |
| | | 769 | | /// </para> |
| | | 770 | | /// </remarks> |
| | | 771 | | public static DocumentSearchResult<T> Search<T>( |
| | | 772 | | this IDocumentsOperations operations, |
| | | 773 | | string searchText, |
| | | 774 | | SearchParameters searchParameters = null, |
| | | 775 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 776 | | { |
| | 112 | 777 | | return operations.SearchAsync<T>(searchText, searchParameters, searchRequestOptions).GetAwaiter().GetResult( |
| | | 778 | | } |
| | | 779 | | |
| | | 780 | | /// <summary> |
| | | 781 | | /// Searches for documents in the search index. |
| | | 782 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/search-documents">Search Documents</see> |
| | | 783 | | /// </summary> |
| | | 784 | | /// <typeparam name="T"> |
| | | 785 | | /// The CLR type that maps to the index schema. Instances of this type can be retrieved as documents |
| | | 786 | | /// from the index. |
| | | 787 | | /// </typeparam> |
| | | 788 | | /// <param name='operations'> |
| | | 789 | | /// The operations group for this extension method. |
| | | 790 | | /// </param> |
| | | 791 | | /// <param name="searchText"> |
| | | 792 | | /// A full-text search query expression; Use null or "*" to match all documents. See |
| | | 793 | | /// <see href="https://docs.microsoft.com/azure/search/query-simple-syntax">Simple query syntax in Azure Cogniti |
| | | 794 | | /// query syntax. |
| | | 795 | | /// </param> |
| | | 796 | | /// <param name="searchParameters"> |
| | | 797 | | /// Parameters to further refine the search query. |
| | | 798 | | /// </param> |
| | | 799 | | /// <param name='searchRequestOptions'> |
| | | 800 | | /// Additional parameters for the operation |
| | | 801 | | /// </param> |
| | | 802 | | /// <param name='cancellationToken'> |
| | | 803 | | /// The cancellation token. |
| | | 804 | | /// </param> |
| | | 805 | | /// <returns> |
| | | 806 | | /// Response containing the documents matching the query. |
| | | 807 | | /// </returns> |
| | | 808 | | /// <remarks> |
| | | 809 | | /// <para> |
| | | 810 | | /// The generic overloads of the Search, SearchAsync, and SearchWithHttpMessagesAsync methods support mapping |
| | | 811 | | /// of search field types to .NET types via the type parameter T. See |
| | | 812 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync<T>(string, System.Collections.Generic.IEnumer |
| | | 813 | | /// for more details on the type mapping. |
| | | 814 | | /// </para> |
| | | 815 | | /// <para> |
| | | 816 | | /// If Azure Cognitive Search can't include all results in a single response, the response returned will include |
| | | 817 | | /// continuation token that can be passed to ContinueSearch to retrieve more results. |
| | | 818 | | /// See <c cref="DocumentSearchResult<T>.ContinuationToken">DocumentSearchResult.ContinuationToken</c> |
| | | 819 | | /// for more information. |
| | | 820 | | /// </para> |
| | | 821 | | /// </remarks> |
| | | 822 | | public static async Task<DocumentSearchResult<T>> SearchAsync<T>( |
| | | 823 | | this IDocumentsOperations operations, |
| | | 824 | | string searchText, |
| | | 825 | | SearchParameters searchParameters = null, |
| | | 826 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 827 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 828 | | { |
| | 112 | 829 | | AzureOperationResponse<DocumentSearchResult<T>> result = await operations.SearchWithHttpMessagesAsync<T>(sea |
| | 104 | 830 | | return result.Body; |
| | 104 | 831 | | } |
| | | 832 | | |
| | | 833 | | /// <summary> |
| | | 834 | | /// Suggests query terms based on input text and matching documents in the search index. |
| | | 835 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/suggestions">Suggestions</see> |
| | | 836 | | /// </summary> |
| | | 837 | | /// <param name='operations'> |
| | | 838 | | /// The operations group for this extension method. |
| | | 839 | | /// </param> |
| | | 840 | | /// <param name="searchText"> |
| | | 841 | | /// The search text on which to base suggestions. |
| | | 842 | | /// </param> |
| | | 843 | | /// <param name="suggesterName"> |
| | | 844 | | /// The name of the suggester as specified in the suggesters collection that's part of the index definition. |
| | | 845 | | /// </param> |
| | | 846 | | /// <param name="suggestParameters"> |
| | | 847 | | /// Parameters to further refine the suggestion query. |
| | | 848 | | /// </param> |
| | | 849 | | /// <param name='searchRequestOptions'> |
| | | 850 | | /// Additional parameters for the operation |
| | | 851 | | /// </param> |
| | | 852 | | /// <returns> |
| | | 853 | | /// Response containing the suggested text and documents matching the query. |
| | | 854 | | /// </returns> |
| | | 855 | | /// <remarks> |
| | | 856 | | /// The non-generic overloads of the Suggest, SuggestAsync, and SuggestWithHttpMessagesAsync methods make a |
| | | 857 | | /// best-effort attempt to map JSON types in the response payload to .NET types. See |
| | | 858 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync(string, System.Collections.Generic.IEnumerable<s |
| | | 859 | | /// for more information. |
| | | 860 | | /// </remarks> |
| | | 861 | | public static DocumentSuggestResult<Document> Suggest( |
| | | 862 | | this IDocumentsOperations operations, |
| | | 863 | | string searchText, |
| | | 864 | | string suggesterName, |
| | | 865 | | SuggestParameters suggestParameters = null, |
| | | 866 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 867 | | { |
| | 16 | 868 | | return operations.SuggestAsync(searchText, suggesterName, suggestParameters, searchRequestOptions).GetAwaite |
| | | 869 | | } |
| | | 870 | | |
| | | 871 | | /// <summary> |
| | | 872 | | /// Suggests query terms based on input text and matching documents in the search index. |
| | | 873 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/suggestions">Suggestions</see> |
| | | 874 | | /// </summary> |
| | | 875 | | /// <param name='operations'> |
| | | 876 | | /// The operations group for this extension method. |
| | | 877 | | /// </param> |
| | | 878 | | /// <param name="searchText"> |
| | | 879 | | /// The search text on which to base suggestions. |
| | | 880 | | /// </param> |
| | | 881 | | /// <param name="suggesterName"> |
| | | 882 | | /// The name of the suggester as specified in the suggesters collection that's part of the index definition. |
| | | 883 | | /// </param> |
| | | 884 | | /// <param name="suggestParameters"> |
| | | 885 | | /// Parameters to further refine the suggestion query. |
| | | 886 | | /// </param> |
| | | 887 | | /// <param name='searchRequestOptions'> |
| | | 888 | | /// Additional parameters for the operation |
| | | 889 | | /// </param> |
| | | 890 | | /// <param name='cancellationToken'> |
| | | 891 | | /// The cancellation token. |
| | | 892 | | /// </param> |
| | | 893 | | /// <returns> |
| | | 894 | | /// Response containing the suggested text and documents matching the query. |
| | | 895 | | /// </returns> |
| | | 896 | | /// <remarks> |
| | | 897 | | /// The non-generic overloads of the Suggest, SuggestAsync, and SuggestWithHttpMessagesAsync methods make a |
| | | 898 | | /// best-effort attempt to map JSON types in the response payload to .NET types. See |
| | | 899 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync(string, System.Collections.Generic.IEnumerable<s |
| | | 900 | | /// for more information. |
| | | 901 | | /// </remarks> |
| | | 902 | | public static async Task<DocumentSuggestResult<Document>> SuggestAsync( |
| | | 903 | | this IDocumentsOperations operations, |
| | | 904 | | string searchText, |
| | | 905 | | string suggesterName, |
| | | 906 | | SuggestParameters suggestParameters = null, |
| | | 907 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 908 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 909 | | { |
| | 16 | 910 | | AzureOperationResponse<DocumentSuggestResult<Document>> result = await operations.SuggestWithHttpMessagesAsy |
| | 8 | 911 | | return result.Body; |
| | 8 | 912 | | } |
| | | 913 | | |
| | | 914 | | /// <summary> |
| | | 915 | | /// Suggests query terms based on input text and matching documents in the search index. |
| | | 916 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/suggestions">Suggestions</see> |
| | | 917 | | /// </summary> |
| | | 918 | | /// <typeparam name="T"> |
| | | 919 | | /// The CLR type that maps to the index schema. Instances of this type can be retrieved as documents |
| | | 920 | | /// from the index. |
| | | 921 | | /// </typeparam> |
| | | 922 | | /// <param name='operations'> |
| | | 923 | | /// The operations group for this extension method. |
| | | 924 | | /// </param> |
| | | 925 | | /// <param name="searchText"> |
| | | 926 | | /// The search text on which to base suggestions. |
| | | 927 | | /// </param> |
| | | 928 | | /// <param name="suggesterName"> |
| | | 929 | | /// The name of the suggester as specified in the suggesters collection that's part of the index definition. |
| | | 930 | | /// </param> |
| | | 931 | | /// <param name="suggestParameters"> |
| | | 932 | | /// Parameters to further refine the suggestion query. |
| | | 933 | | /// </param> |
| | | 934 | | /// <param name='searchRequestOptions'> |
| | | 935 | | /// Additional parameters for the operation |
| | | 936 | | /// </param> |
| | | 937 | | /// <returns> |
| | | 938 | | /// Response containing the suggested text and documents matching the query. |
| | | 939 | | /// </returns> |
| | | 940 | | /// <remarks> |
| | | 941 | | /// The generic overloads of the Suggest, SuggestAsync, and SuggestWithHttpMessagesAsync methods support |
| | | 942 | | /// mapping of search field types to .NET types via the type parameter T. See |
| | | 943 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync<T>(string, System.Collections.Generic.IEnumer |
| | | 944 | | /// for more details on the type mapping. |
| | | 945 | | /// </remarks> |
| | | 946 | | public static DocumentSuggestResult<T> Suggest<T>( |
| | | 947 | | this IDocumentsOperations operations, |
| | | 948 | | string searchText, |
| | | 949 | | string suggesterName, |
| | | 950 | | SuggestParameters suggestParameters = null, |
| | | 951 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) |
| | | 952 | | { |
| | 56 | 953 | | return operations.SuggestAsync<T>(searchText, suggesterName, suggestParameters, searchRequestOptions).GetAwa |
| | | 954 | | } |
| | | 955 | | |
| | | 956 | | /// <summary> |
| | | 957 | | /// Suggests query terms based on input text and matching documents in the search index. |
| | | 958 | | /// <see href="https://docs.microsoft.com/rest/api/searchservice/suggestions">Suggestions</see> |
| | | 959 | | /// </summary> |
| | | 960 | | /// <typeparam name="T"> |
| | | 961 | | /// The CLR type that maps to the index schema. Instances of this type can be retrieved as documents |
| | | 962 | | /// from the index. |
| | | 963 | | /// </typeparam> |
| | | 964 | | /// <param name='operations'> |
| | | 965 | | /// The operations group for this extension method. |
| | | 966 | | /// </param> |
| | | 967 | | /// <param name="searchText"> |
| | | 968 | | /// The search text on which to base suggestions. |
| | | 969 | | /// </param> |
| | | 970 | | /// <param name="suggesterName"> |
| | | 971 | | /// The name of the suggester as specified in the suggesters collection that's part of the index definition. |
| | | 972 | | /// </param> |
| | | 973 | | /// <param name="suggestParameters"> |
| | | 974 | | /// Parameters to further refine the suggestion query. |
| | | 975 | | /// </param> |
| | | 976 | | /// <param name='searchRequestOptions'> |
| | | 977 | | /// Additional parameters for the operation |
| | | 978 | | /// </param> |
| | | 979 | | /// <param name='cancellationToken'> |
| | | 980 | | /// The cancellation token. |
| | | 981 | | /// </param> |
| | | 982 | | /// <returns> |
| | | 983 | | /// Response containing the suggested text and documents matching the query. |
| | | 984 | | /// </returns> |
| | | 985 | | /// <remarks> |
| | | 986 | | /// The generic overloads of the Suggest, SuggestAsync, and SuggestWithHttpMessagesAsync methods support |
| | | 987 | | /// mapping of search field types to .NET types via the type parameter T. See |
| | | 988 | | /// <see cref="IDocumentsOperations.GetWithHttpMessagesAsync<T>(string, System.Collections.Generic.IEnumer |
| | | 989 | | /// for more details on the type mapping. |
| | | 990 | | /// </remarks> |
| | | 991 | | public static async Task<DocumentSuggestResult<T>> SuggestAsync<T>( |
| | | 992 | | this IDocumentsOperations operations, |
| | | 993 | | string searchText, |
| | | 994 | | string suggesterName, |
| | | 995 | | SuggestParameters suggestParameters = null, |
| | | 996 | | SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), |
| | | 997 | | CancellationToken cancellationToken = default(CancellationToken)) |
| | | 998 | | { |
| | 56 | 999 | | AzureOperationResponse<DocumentSuggestResult<T>> result = await operations.SuggestWithHttpMessagesAsync<T>(s |
| | 56 | 1000 | | return result.Body; |
| | 56 | 1001 | | } |
| | | 1002 | | } |
| | | 1003 | | } |