Class SearchIndexerDataSources

java.lang.Object
com.azure.search.documents.indexes.SearchIndexerDataSources

public final class SearchIndexerDataSources extends Object
Utility class that aids in the creation of SearchIndexerDataSourceConnections.
  • Method Details

    • createFromAzureSql

      public static SearchIndexerDataSourceConnection createFromAzureSql(String dataSourceName, String sqlConnectionString, String tableOrViewName, String description, DataChangeDetectionPolicy changeDetectionPolicy, DataDeletionDetectionPolicy deletionDetectionPolicy)
      Creates a new SearchIndexerDataSourceConnection to connect to an Azure SQL database.
      Parameters:
      dataSourceName - The name of the data source.
      sqlConnectionString - The connection string for the Azure SQL database.
      tableOrViewName - The name of the table or view from which to read rows.
      description - Optional. Description of the data source.
      changeDetectionPolicy - The change detection policy for the data source. Note that only high watermark change detection is allowed for Azure SQL when deletion detection is enabled.
      deletionDetectionPolicy - Optional. The data deletion detection policy for the data source.
      Returns:
      A new Azure SQL SearchIndexerDataSourceConnection instance.
      Throws:
      IllegalArgumentException - If dataSourceName, sqlConnectionString, or tableOrViewName is null or empty.
    • createFromAzureSql

      public static SearchIndexerDataSourceConnection createFromAzureSql(String dataSourceName, String sqlConnectionString, String tableOrViewName)
      Creates a new SearchIndexerDataSourceConnection to connect to an Azure SQL database.
      Parameters:
      dataSourceName - The name of the data source.
      sqlConnectionString - The connection string for the Azure SQL database.
      tableOrViewName - The name of the table or view from which to read rows.
      Returns:
      A new Azure SQL SearchIndexerDataSourceConnection instance.
      Throws:
      IllegalArgumentException - If dataSourceName, sqlConnectionString, or tableOrViewName is null or empty.
    • createFromAzureBlobStorage

      public static SearchIndexerDataSourceConnection createFromAzureBlobStorage(String dataSourceName, String storageConnectionString, String containerName, String pathPrefix, String description, DataDeletionDetectionPolicy deletionDetectionPolicy)
      Creates a new SearchIndexerDataSourceConnection to connect to an Azure Blob container.
      Parameters:
      dataSourceName - The name of the data source.
      storageConnectionString - The connection string for the Azure Storage account. The Storage connection string must use this format:

      "DefaultEndpointsProtocol=https;AccountName=[your storage account];AccountKey=[your account key]:

      Note: The connection string must use HTTPS.

      containerName - The name of the container from which to read blobs.
      pathPrefix - Optional. Limits the data source to only include blobs starting with the specified prefix, this is useful when blobs are organized into "virtual folders".
      description - Optional. Description of the data source
      deletionDetectionPolicy - Optional. The data deletion detection policy for the data source
      Returns:
      A new Azure Blob SearchIndexerDataSourceConnection instance.
      Throws:
      IllegalArgumentException - If dataSourceName, containerName or storageConnectionString is null or empty.
    • createFromAzureBlobStorage

      public static SearchIndexerDataSourceConnection createFromAzureBlobStorage(String dataSourceName, String storageConnectionString, String containerName)
      Creates a new SearchIndexerDataSourceConnection to connect to an Azure Blob container.
      Parameters:
      dataSourceName - The name of the data source.
      storageConnectionString - The connection string for the Azure Storage account. The Storage connection string must use this format:

      "DefaultEndpointsProtocol=https;AccountName=[your storage account];AccountKey=[your account key]:

      Note: The connection string must use HTTPS.

      containerName - The name of the container from which to read blobs.
      Returns:
      A new Azure Blob SearchIndexerDataSourceConnection instance.
      Throws:
      IllegalArgumentException - If dataSourceName, containerName or storageConnectionString is null or empty.
    • createFromAzureTableStorage

      public static SearchIndexerDataSourceConnection createFromAzureTableStorage(String dataSourceName, String storageConnectionString, String tableName, String query, String description, DataDeletionDetectionPolicy deletionDetectionPolicy)
      Creates a new SearchIndexerDataSourceConnection to connect to an Azure Table.
      Parameters:
      dataSourceName - The name of the data source.
      storageConnectionString - The connection string for the Azure Storage account. The Storage connection string must use this format:

      "DefaultEndpointsProtocol=https;AccountName=[your storage account];AccountKey=[your account key]:

      Note: The connection string must use HTTPS.

      tableName - The name of the Azure table from which to read rows.
      query - Optional. A query that is applied to the table when reading rows.
      description - Optional. Description of the data source
      deletionDetectionPolicy - Optional. The data deletion detection policy for the data source.
      Returns:
      A new Azure Table SearchIndexerDataSourceConnection instance.
      Throws:
      IllegalArgumentException - If dataSourceName, tableName, or storageConnectionString is null or empty.
    • createFromAzureTableStorage

      public static SearchIndexerDataSourceConnection createFromAzureTableStorage(String dataSourceName, String storageConnectionString, String tableName)
      Creates a new SearchIndexerDataSourceConnection to connect to an Azure Table.
      Parameters:
      dataSourceName - The name of the data source.
      storageConnectionString - The connection string for the Azure Storage account. The Storage connection string must use this format:

      "DefaultEndpointsProtocol=https;AccountName=[your storage account];AccountKey=[your account key]:

      Note: The connection string must use HTTPS.

      tableName - The name of the Azure table from which to read rows.
      Returns:
      A new Azure Table SearchIndexerDataSourceConnection instance.
      Throws:
      IllegalArgumentException - If dataSourceName, tableName, or storageConnectionString is null or empty.
    • createFromCosmos

      public static SearchIndexerDataSourceConnection createFromCosmos(String dataSourceName, String cosmosConnectionString, String collectionName, String query, Boolean useChangeDetection, String description, DataDeletionDetectionPolicy deletionDetectionPolicy)
      Creates a new SearchIndexerDataSourceConnection to connect to a Cosmos database.
      Parameters:
      dataSourceName - The name of the data source.
      cosmosConnectionString - The connection string for the Cosmos database. It must follow this format:

      AccountName|AccountEndpoint=[your account name or endpoint]; AccountKey=[your account key];Database=[your database name]"

      collectionName - The name of the collection from which to read documents.
      query - Optional. A query that is applied to the collection when reading documents.
      useChangeDetection - Optional. Indicates whether to use change detection when indexing. Default is true.
      description - Optional. Description of the data source
      deletionDetectionPolicy - Optional. The data deletion detection policy for the data source.
      Returns:
      A new Cosmos SearchIndexerDataSourceConnection instance.
      Throws:
      IllegalArgumentException - If dataSourceName, collectionName, or cosmosConnectionString is null or empty.
    • createFromCosmos

      public static SearchIndexerDataSourceConnection createFromCosmos(String dataSourceName, String cosmosConnectionString, String collectionName, Boolean useChangeDetection)
      Creates a new SearchIndexerDataSourceConnection to connect to a Cosmos database.
      Parameters:
      dataSourceName - The name of the data source.
      cosmosConnectionString - The connection string for the Cosmos database. It must follow this format:

      AccountName|AccountEndpoint=[your account name or endpoint]; AccountKey=[your account key];Database=[your database name]"

      collectionName - The name of the collection from which to read documents
      useChangeDetection - Optional. Indicates whether to use change detection when indexing. Default is true.
      Returns:
      A new Cosmos SearchIndexerDataSourceConnection instance.
      Throws:
      IllegalArgumentException - If dataSourceName, collectionName, or cosmosConnectionString is null or empty.
    • createFromCosmos

      public static SearchIndexerDataSourceConnection createFromCosmos(String dataSourceName, String cosmosConnectionString, String collectionName)
      Creates a new SearchIndexerDataSourceConnection to connect to a Cosmos database with change detection set to true.
      Parameters:
      dataSourceName - The name of the data source.
      cosmosConnectionString - The connection string for the Cosmos database. It must follow this format:

      AccountName|AccountEndpoint=[your account name or endpoint]; AccountKey=[your account key];Database=[your database name]"

      collectionName - The name of the collection from which to read documents
      Returns:
      A new Cosmos SearchIndexerDataSourceConnection instance.
      Throws:
      IllegalArgumentException - If dataSourceName, collectionName, or cosmosConnectionString is null or empty.