public IndexesOperationsWrapper(
     IIndexesOperations inner,
     ILogger <DocumentsOperationsWrapper> documentsOperationsLogger)
 {
     _inner = inner ?? throw new ArgumentNullException(nameof(inner));
     _documentsOperationsLogger = documentsOperationsLogger ?? throw new ArgumentNullException(nameof(documentsOperationsLogger));
 }
 /// <summary>
 /// Determines whether or not the given index exists in the Azure Search service.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name="indexName">
 /// The name of the index.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation.
 /// </param>
 /// <returns>
 /// <c>true</c> if the index exists; <c>false</c> otherwise.
 /// </returns>
 public static bool Exists(
     this IIndexesOperations operations,
     string indexName,
     SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
 {
     return(operations.ExistsAsync(indexName, searchRequestOptions).GetAwaiter().GetResult());
 }
示例#3
0
 /// <summary>
 /// Creates a new search index or updates an index if it already exists.
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/searchservice/update-index">Update Index</see>.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='indexName'>
 /// The definition of the index to create or update.
 /// </param>
 /// <param name='index'>
 /// The definition of the index to create or update.
 /// </param>
 /// <param name='allowIndexDowntime'>
 /// Allows new analyzers, tokenizers, token filters, or char filters to be
 /// added to an index by taking the index offline for at least a few seconds.
 /// This temporarily causes indexing and query requests to fail. Performance
 /// and write availability of the index can be impaired for several minutes
 /// after the index is updated, or longer for very large indexes.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='accessCondition'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Index> CreateOrUpdateAsync(this IIndexesOperations operations, string indexName, Index index, bool?allowIndexDowntime = default(bool?), SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), AccessCondition accessCondition = default(AccessCondition), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(indexName, index, allowIndexDowntime, searchRequestOptions, accessCondition, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#4
0
 /// <summary>
 /// Shows how an analyzer breaks text into tokens.
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/searchservice/test-analyzer">Analyze Text</see>.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='indexName'>
 /// The name of the index for which to test an analyzer.
 /// </param>
 /// <param name='request'>
 /// The text and analyzer or analysis components to test.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <AnalyzeResult> AnalyzeAsync(this IIndexesOperations operations, string indexName, AnalyzeRequest request, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.AnalyzeWithHttpMessagesAsync(indexName, request, searchRequestOptions, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#5
0
 /// <summary>
 /// Creates a new search index.
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/searchservice/create-index">Create Index</see>.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='index'>
 /// The definition of the index to create.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Index> CreateAsync(this IIndexesOperations operations, Index index, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateWithHttpMessagesAsync(index, searchRequestOptions, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#6
0
 /// <summary>
 /// Lists all indexes available for a search service.
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/searchservice/list-indexes">List Indexes</see>.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='select'>
 /// Selects which properties of the index definitions to retrieve. Specified as
 /// a comma-separated list of JSON property names, or '*' for all properties.
 /// The default is all properties.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IndexListResult> ListAsync(this IIndexesOperations operations, string select = default(string), SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListWithHttpMessagesAsync(select, searchRequestOptions, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Determines whether or not the given index exists in the Azure Search service.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name="indexName">
 /// The name of the index.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <returns>
 /// <c>true</c> if the index exists; <c>false</c> otherwise.
 /// </returns>
 public static bool Exists(
     this IIndexesOperations operations,
     string indexName,
     SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
 {
     return(Task.Factory.StartNew(s => ((IIndexesOperations)s).ExistsAsync(indexName, searchRequestOptions), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
示例#8
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     DataSources     = new DataSourcesOperations(this);
     Indexers        = new IndexersOperations(this);
     Skillsets       = new SkillsetsOperations(this);
     SynonymMaps     = new SynonymMapsOperations(this);
     Indexes         = new IndexesOperations(this);
     BaseUri         = "https://{searchServiceName}.{searchDnsSuffix}";
     ApiVersion      = "2019-05-06";
     SearchDnsSuffix = "search.windows.net";
     AcceptLanguage  = "en-US";
     LongRunningOperationRetryTimeout = 30;
     GenerateClientRequestId          = true;
     SerializationSettings            = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <Analyzer>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <Analyzer>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <Tokenizer>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <Tokenizer>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <TokenFilter>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <TokenFilter>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <CharFilter>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <CharFilter>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <DataChangeDetectionPolicy>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <DataChangeDetectionPolicy>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <DataDeletionDetectionPolicy>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <DataDeletionDetectionPolicy>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <ScoringFunction>("type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <ScoringFunction>("type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <Skill>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <Skill>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <CognitiveServices>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <CognitiveServices>("@odata.type"));
     CustomInitialize();
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }
        /// <summary>
        /// Lists the names of all indexes available for an Azure Search
        /// service. Use this instead of List() when you only need index
        /// names. It will save bandwidth and resource utilization, especially
        /// if your Search Service has many indexes.
        /// <see href="https://docs.microsoft.com/rest/api/searchservice/List-Indexes"/>
        /// </summary>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='searchRequestOptions'>
        /// Additional parameters for the operation.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The list of all index names for the search service.
        /// </returns>
        public static async Task <IList <string> > ListNamesAsync(
            this IIndexesOperations operations,
            SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
            CancellationToken cancellationToken       = default(CancellationToken))
        {
            IndexListResult indexList =
                await operations.ListAsync(select : "name", searchRequestOptions : searchRequestOptions, cancellationToken : cancellationToken).ConfigureAwait(false);

            return(GetIndexNames(indexList));
        }
        /// <summary>
        /// Determines whether or not the given index exists in the Azure Search service.
        /// </summary>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name="indexName">
        /// The name of the index.
        /// </param>
        /// <param name='searchRequestOptions'>
        /// Additional parameters for the operation.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// <c>true</c> if the index exists; <c>false</c> otherwise.
        /// </returns>
        public static async Task <bool> ExistsAsync(
            this IIndexesOperations operations,
            string indexName,
            SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
            CancellationToken cancellationToken       = default(CancellationToken))
        {
            AzureOperationResponse <bool> result = await operations.ExistsWithHttpMessagesAsync(indexName, searchRequestOptions, null, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
 public IndexesOperationsWrapper(
     IIndexesOperations inner,
     DelegatingHandler[] handlers,
     RetryPolicy retryPolicy,
     ILogger <DocumentsOperationsWrapper> documentsOperationsLogger)
 {
     _inner       = inner ?? throw new ArgumentNullException(nameof(inner));
     _handlers    = handlers ?? throw new ArgumentNullException(nameof(handlers));
     _retryPolicy = retryPolicy;
     _documentsOperationsLogger = documentsOperationsLogger ?? throw new ArgumentNullException(nameof(documentsOperationsLogger));
 }
示例#12
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     this.DataSources    = new DataSourcesOperations(this);
     this.Indexers       = new IndexersOperations(this);
     this.Indexes        = new IndexesOperations(this);
     this.BaseUri        = new Uri("http://localhost");
     this.ApiVersion     = "2015-02-28-Preview";
     this.AcceptLanguage = "en-US";
     this.LongRunningOperationRetryTimeout = 30;
     this.GenerateClientRequestId          = true;
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Formatting.Indented,
         DateFormatHandling    = DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = DateTimeZoneHandling.Utc,
         NullValueHandling     = NullValueHandling.Ignore,
         ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = DateTimeZoneHandling.Utc,
         NullValueHandling     = NullValueHandling.Ignore,
         ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <Analyzer>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <Analyzer>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <Tokenizer>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <Tokenizer>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <TokenFilter>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <TokenFilter>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <CharFilter>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <CharFilter>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <DataChangeDetectionPolicy>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <DataChangeDetectionPolicy>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <DataDeletionDetectionPolicy>("@odata.type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <DataDeletionDetectionPolicy>("@odata.type"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <ScoringFunction>("type"));
     DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <ScoringFunction>("type"));
     CustomInitialize();
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }
        /// <summary>
        /// Creates a new index client for querying and managing documents in a given index.
        /// </summary>
        /// <param name="indexName">The name of the index.</param>
        /// <returns>A new <c cref="Microsoft.Azure.Search.SearchIndexClient">SearchIndexClient</c> instance.</returns>
        /// <remarks>
        /// The new client is configured with full read-write access to the index. If you are only planning to use the
        /// client for query operations, we recommend directly creating a
        /// <c cref="Microsoft.Azure.Search.SearchIndexClient">SearchIndexClient</c> instance instead.
        /// </remarks>
        public static ISearchIndexClient GetClient(this IIndexesOperations operations, string indexName)
        {
            // Argument checking is done by the SearchIndexClient constructor. Note that HttpClient can't be shared in
            // case it has already been used (SearchIndexClient will attempt to set the Timeout property on it).
            SearchServiceClient serviceClient = operations.Client;
            var rootHandler = serviceClient.HttpMessageHandlers.OfType <HttpClientHandler>().SingleOrDefault();
            var indexClient =
                new SearchIndexClient(serviceClient.SearchServiceName, indexName, serviceClient.SearchCredentials, rootHandler)
            {
                SearchDnsSuffix = serviceClient.SearchDnsSuffix
            };

            indexClient.HttpClient.Timeout = serviceClient.HttpClient.Timeout;
            return(indexClient);
        }
示例#14
0
 /// <summary>
 /// Creates a new search index or updates an index if it already exists.
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/searchservice/update-index">Update Index</see>.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='indexName'>
 /// The definition of the index to create or update.
 /// </param>
 /// <param name='index'>
 /// The definition of the index to create or update.
 /// </param>
 /// <param name='allowIndexDowntime'>
 /// Allows new analyzers, tokenizers, token filters, or char filters to be
 /// added to an index by taking the index offline for at least a few seconds.
 /// This temporarily causes indexing and query requests to fail. Performance
 /// and write availability of the index can be impaired for several minutes
 /// after the index is updated, or longer for very large indexes.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='accessCondition'>
 /// Additional parameters for the operation
 /// </param>
 public static Index CreateOrUpdate(this IIndexesOperations operations, string indexName, Index index, bool?allowIndexDowntime = default(bool?), SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), AccessCondition accessCondition = default(AccessCondition))
 {
     return(operations.CreateOrUpdateAsync(indexName, index, allowIndexDowntime, searchRequestOptions, accessCondition).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Creates a new Azure Search index or updates an index if it already exists.
 /// <see href="https://msdn.microsoft.com/library/azure/dn800964.aspx" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='indexName'>
 /// The definition of the index to create or update.
 /// </param>
 /// <param name='index'>
 /// The definition of the index to create or update.
 /// </param>
 /// <param name='allowIndexDowntime'>
 /// Allows new analyzers, tokenizers, token filters, or char filters to be
 /// added to an index by taking the index offline for at least a few seconds.
 /// This temporarily causes indexing and query requests to fail. Performance
 /// and write availability of the index can be impaired for several minutes
 /// after the index is updated, or longer for very large indexes.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='accessCondition'>
 /// Additional parameters for the operation
 /// </param>
 public static Index CreateOrUpdate(this IIndexesOperations operations, string indexName, Index index, bool?allowIndexDowntime = default(bool?), SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), AccessCondition accessCondition = default(AccessCondition))
 {
     return(Task.Factory.StartNew(s => ((IIndexesOperations)s).CreateOrUpdateAsync(indexName, index, allowIndexDowntime, searchRequestOptions, accessCondition), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Deletes an Azure Search index and all the documents it contains.
 /// <see href="https://msdn.microsoft.com/library/azure/dn798926.aspx" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='indexName'>
 /// The name of the index to delete.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='accessCondition'>
 /// Additional parameters for the operation
 /// </param>
 public static void Delete(this IIndexesOperations operations, string indexName, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), AccessCondition accessCondition = default(AccessCondition))
 {
     Task.Factory.StartNew(s => ((IIndexesOperations)s).DeleteAsync(indexName, searchRequestOptions, accessCondition), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
示例#17
0
 /// <summary>
 /// Lists all indexes available for a search service.
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/searchservice/list-indexes">List Indexes</see>.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='select'>
 /// Selects which properties of the index definitions to retrieve. Specified as
 /// a comma-separated list of JSON property names, or '*' for all properties.
 /// The default is all properties.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 public static IndexListResult List(this IIndexesOperations operations, string select = default(string), SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
 {
     return(operations.ListAsync(select, searchRequestOptions).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Creates a new Azure Search index.
 /// <see href="https://msdn.microsoft.com/library/azure/dn798941.aspx" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='index'>
 /// The definition of the index to create.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 public static Index Create(this IIndexesOperations operations, Index index, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
 {
     return(Task.Factory.StartNew(s => ((IIndexesOperations)s).CreateAsync(index, searchRequestOptions), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
示例#19
0
 /// <summary>
 /// Creates a new search index.
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/searchservice/create-index">Create Index</see>.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='index'>
 /// The definition of the index to create.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 public static Index Create(this IIndexesOperations operations, Index index, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
 {
     return(operations.CreateAsync(index, searchRequestOptions).GetAwaiter().GetResult());
 }
示例#20
0
 /// <summary>
 /// Shows how an analyzer breaks text into tokens.
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/searchservice/test-analyzer">Analyze Text</see>.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='indexName'>
 /// The name of the index for which to test an analyzer.
 /// </param>
 /// <param name='request'>
 /// The text and analyzer or analysis components to test.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 public static AnalyzeResult Analyze(this IIndexesOperations operations, string indexName, AnalyzeRequest request, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
 {
     return(operations.AnalyzeAsync(indexName, request, searchRequestOptions).GetAwaiter().GetResult());
 }
示例#21
0
 /// <summary>
 /// Deletes a search index and all the documents it contains.
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/searchservice/delete-index">Delete Index</see>.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='indexName'>
 /// The name of the index to delete.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='accessCondition'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteAsync(this IIndexesOperations operations, string indexName, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), AccessCondition accessCondition = default(AccessCondition), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteWithHttpMessagesAsync(indexName, searchRequestOptions, accessCondition, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
示例#22
0
 /// <summary>
 /// Deletes a search index and all the documents it contains.
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/searchservice/delete-index">Delete Index</see>.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='indexName'>
 /// The name of the index to delete.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='accessCondition'>
 /// Additional parameters for the operation
 /// </param>
 public static void Delete(this IIndexesOperations operations, string indexName, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), AccessCondition accessCondition = default(AccessCondition))
 {
     operations.DeleteAsync(indexName, searchRequestOptions, accessCondition).GetAwaiter().GetResult();
 }
 /// <summary>
 /// Lists all indexes available for an Azure Search service.
 /// <see href="https://msdn.microsoft.com/library/azure/dn798923.aspx" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='select'>
 /// Selects which properties of the index definitions to retrieve. Specified
 /// as a comma-separated list of JSON property names, or '*' for all
 /// properties. The default is all properties.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation
 /// </param>
 public static IndexListResult List(this IIndexesOperations operations, string select = default(string), SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
 {
     return(Task.Factory.StartNew(s => ((IIndexesOperations)s).ListAsync(select, searchRequestOptions), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Lists the names of all indexes available for an Azure Search
 /// service. Use this instead of List() when you only need index
 /// names. It will save bandwidth and resource utilization, especially
 /// if your Search Service has many indexes.
 /// <see href="https://docs.microsoft.com/rest/api/searchservice/List-Indexes"/>
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='searchRequestOptions'>
 /// Additional parameters for the operation.
 /// </param>
 /// <returns>
 /// The list of all index names for the search service.
 /// </returns>
 public static IList <string> ListNames(
     this IIndexesOperations operations,
     SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
 {
     return(GetIndexNames(operations.List(select: "name", searchRequestOptions: searchRequestOptions)));
 }