Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new Azure Search index.  (see
 /// https://msdn.microsoft.com/library/azure/dn798941.aspx for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Search.IIndexOperations.
 /// </param>
 /// <param name='index'>
 /// Required. The definition of the index to create.
 /// </param>
 /// <returns>
 /// Response from a Create, Update, or Get Index request. If
 /// successful, it includes the full definition of the index that was
 /// created, updated, or retrieved.
 /// </returns>
 public static IndexDefinitionResponse Create(this IIndexOperations operations, Index index)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IIndexOperations)s).CreateAsync(index);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Ejemplo n.º 2
0
 /// <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://msdn.microsoft.com/library/azure/dn798923.aspx"/>
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Search.IIndexOperations.
 /// </param>
 /// <returns>
 /// Response from a List Index Names request. If successful, it
 /// includes the name of each index.
 /// </returns>
 public static IndexListNamesResponse ListNames(this IIndexOperations operations)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IIndexOperations)s).ListNamesAsync();
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Determines whether or not the given index exists in the Azure Search service.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Search.IIndexOperations.
 /// </param>
 /// <param name="indexName">
 /// The name of the index.
 /// </param>
 /// <returns>
 /// <c>true</c> if the index exists; <c>false</c> otherwise.
 /// </returns>
 public static bool Exists(this IIndexOperations operations, string indexName)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IIndexOperations)s).ExistsAsync(indexName);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Initializes a new instance of the SearchServiceClient class.
 /// </summary>
 /// <param name='httpClient'>
 /// The Http client
 /// </param>
 private SearchServiceClient(HttpClient httpClient)
     : base(httpClient)
 {
     this._dataSources       = new DataSourceOperations(this);
     this._indexers          = new IndexerOperations(this);
     this._indexes           = new IndexOperations(this);
     this._apiVersion        = "2015-02-28";
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
 /// <summary>
 /// Initializes a new instance of the SearchServiceClient class.
 /// </summary>
 /// <param name='httpClient'>
 /// The Http client
 /// </param>
 public SearchServiceClient(HttpClient httpClient)
     : base(httpClient)
 {
     this._indexes    = new IndexOperations(this);
     this._apiVersion = "2015-02-28";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
 public static Index ToIndex(this AzureIndex azureIdx, IIndexOperations indexes)
 {
     return ToIndex(azureIdx, indexes.GetClient(azureIdx.Name));
 }
Ejemplo n.º 7
0
 /// <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://msdn.microsoft.com/library/azure/dn798923.aspx"/>
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Search.IIndexOperations.
 /// </param>
 /// <returns>
 /// Response from a List Index Names request. If successful, it
 /// includes the name of each index.
 /// </returns>
 public static Task <IndexListNamesResponse> ListNamesAsync(this IIndexOperations operations)
 {
     return(operations.ListNamesAsync(CancellationToken.None));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Determines whether or not the given index exists in the Azure Search service.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Search.IIndexOperations.
 /// </param>
 /// <param name="indexName">
 /// The name of the index.
 /// </param>
 /// <returns>
 /// <c>true</c> if the index exists; <c>false</c> otherwise.
 /// </returns>
 public static Task <bool> ExistsAsync(this IIndexOperations operations, string indexName)
 {
     return(operations.ExistsAsync(indexName, CancellationToken.None));
 }
Ejemplo n.º 9
0
 public AzureItemCrawler(IIndexOperations indexOperations)
     : base(indexOperations)
 {
     base.Operations = indexOperations;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Creates a new Azure Search index.  (see
 /// https://msdn.microsoft.com/library/azure/dn798941.aspx for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Search.IIndexOperations.
 /// </param>
 /// <param name='index'>
 /// Required. The definition of the index to create.
 /// </param>
 /// <returns>
 /// Response from a Create, Update, or Get Index request. If
 /// successful, it includes the full definition of the index that was
 /// created, updated, or retrieved.
 /// </returns>
 public static Task <IndexDefinitionResponse> CreateAsync(this IIndexOperations operations, Index index)
 {
     return(operations.CreateAsync(index, CancellationToken.None));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Returns statistics for the given index, including a document count
 /// and storage usage.  (see
 /// https://msdn.microsoft.com/library/azure/dn798942.aspx for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Search.IIndexOperations.
 /// </param>
 /// <param name='indexName'>
 /// Required. The name of the index for which to retrieve statistics.
 /// </param>
 /// <returns>
 /// Statistics for a given index. Statistics are collected periodically
 /// and are not guaranteed to always be up-to-date.
 /// </returns>
 public static Task <IndexGetStatisticsResponse> GetStatisticsAsync(this IIndexOperations operations, string indexName)
 {
     return(operations.GetStatisticsAsync(indexName, CancellationToken.None));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Deletes an Azure Search index and all the documents it contains.
 /// (see https://msdn.microsoft.com/library/azure/dn798926.aspx for
 /// more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Search.IIndexOperations.
 /// </param>
 /// <param name='indexName'>
 /// Required. The name of the index to delete.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task <AzureOperationResponse> DeleteAsync(this IIndexOperations operations, string indexName)
 {
     return(operations.DeleteAsync(indexName, CancellationToken.None));
 }