Azure 认知搜索的 Java 代码示例Java code samples for Azure Cognitive Search

了解演示 Azure 认知搜索的特性和功能的 Java 代码示例。Learn about the Java code samples that demonstrate the features and functionality of Azure Cognitive Search. 主存储库如下所示:The primary repositories are as follows:

存储库Repository 说明Description
azure-sdk-for-java/tree/master/sdk/search/azure-search-documents/src/samplesazure-sdk-for-java/tree/master/sdk/search/azure-search-documents/src/samples 由 Azure SDK 团队生成的随 SDK 中 Azure.Search.Documents 客户端库一起提供的示例。Samples produced by the Azure SDK team that ship with the Azure.Search.Documents client library in the SDK. 你还可以查看客户端库的单元测试,以了解如何调用各种 API。You can also review unit tests for the client library to see how various APIs are called.
Azure-Samples/azure-search-java-samplesAzure-Samples/azure-search-java-samples 操作方法文章附带的代码示例。Code samples that accompany how-to articles. 此存储库中的示例尚未更新为使用适用于 Java 的 Azure SDK。Samples in this repository are not yet updated to the use the Azure SDK for Java. 目前,这些示例在 Java 代码中调用 REST API。Currently, these samples call REST APIs in Java code.

提示

请尝试使用示例浏览器来搜索 Github 中的 Microsoft 代码示例,搜索时可按产品、服务和语言进行筛选。Try the Samples browser to search for Microsoft code samples in Github, filtered by product, service, and language.

Java SDK 示例Java SDK samples

适用于 Java 的 Azure SDK 包含大量示例和一个涉及包安装的入门页面The Azure SDK for Java includes numerous samples and a getting started page that covers package installation. 该页面还列出了多种示例。The page also lists a wide range of examples. 为方便起见,下面列出了几项比较常见的操作。Several of the more common operations are listed below for your convenience.

示例Samples 说明Description
搜索索引创建Search index creation 演示如何创建搜索索引Demonstrates how to create search indexes.
同义词创建Synonym creation 演示如何创建同义词映射Demonstrates how to create synonym maps.
搜索索引器创建Search indexer creation 演示如何创建索引器Demonstrates how to create indexers.
搜索索引器数据源创建Search indexer data source creation 演示如何创建索引器数据源,对于基于索引器为受支持的 Azure 数据源编制索引而言,这些数据源是必需的。Demonstrates how to create indexer data sources, required for indexer-based indexing of supported Azure data sources.
技能组创建Skillset creation 演示如何创建技能组,这些技能组是附加的索引器,并且在编制索引期间执行基于 AI 的扩充。Demonstrates how to create skillsets that are attached indexers, and that perform AI-based enrichment during indexing.
加载文档Load documents 演示如何在数据导入操作中将文档上传或合并到索引中。Demonstrates how to upload or merge documents into an index in a data import operation.
查询语法Query syntax 演示如何设置基本查询Demonstrates how to set up a basic query.

文档示例Documentation samples

Azure 认知搜索文档中有与以下示例相关联的文章。The following samples have an associated article in Azure Cognitive Search documentation.

示例Samples 说明Description
快速入门quickstart 用于快速入门:用 Java 创建搜索索引的源代码。Source code for Quickstart: Create a search index in Java. 此示例调用 REST API。This sample calls the REST APIs.
search-java-indexer-demosearch-java-indexer-demo 演示使用 Java 编写的 Azure Cosmos DB 索引器。Demonstrates an Azure Cosmos DB indexer in Java. 此示例调用 REST API。This sample calls the REST APIs.