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

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

存储库Repository 说明Description
azure-sdk-for-js/tree/master/sdk/search/search-documentsazure-sdk-for-js/tree/master/sdk/search/search-documents 由 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-javascript-samplesAzure-Samples/azure-search-javascript-samples 操作方法文章附带的代码示例,包括快速入门:在 JavaScript 中创建搜索索引Code samples that accompany how-to articles, including Quickstart: Create a search index in JavaScript.

提示

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

JavaScript SDK 示例JavaScript SDK samples

适用于 Java 的 Azure SDK 包含大量示例和一个介绍包安装、客户端设置和故障排除的入门页面The Azure SDK for Java includes numerous samples and a getting started page that covers package install, client setup, and troubleshooting. 此页面还介绍了以下示例类别,为方便起见,这些示例类别在此处列出。The page also describes the following sample categories, listed here for your convenience.

示例Samples 说明Description
索引indexes 演示如何创建、更新、获取、列出和删除搜索索引Demonstrates how to create, update, get, list, and delete search indexes. 此样本类别还包括一个服务统计信息示例。This sample category also includes a service statistic sample.
dataSourceConnections(用于索引器)dataSourceConnections (for indexers) 演示如何创建、更新、获取、列出和删除索引器数据源,对于基于索引器为支持的 Azure 数据源编制索引而言,这些数据源是必需的。Demonstrates how to create, update, get, list, and delete indexer data sources, required for indexer-based indexing of supported Azure data sources.
索引器indexers 演示如何创建、更新、获取、列出、重置和删除索引器Demonstrates how to create, update, get, list, reset and delete indexers.
skillSetskillSet 演示如何创建、更新、获取、列出和删除技能组,这些技能组是附加的索引器,并且在编制索引期间执行基于 AI 的扩充。Demonstrates how to create, update, get, list, and delete skillsets that are attached indexers, and that perform AI-based enrichment during indexing.
synonymMapssynonymMaps 演示如何创建、更新、获取、列出和删除同义词映射Demonstrates how to create, update, get, list, and delete synonym maps.
查询Queries 演示如何针对 Microsoft 托管的只读公共索引执行查询。Demonstrates query execution against a read-only public index hosted by Microsoft.

TypeScript 示例TypeScript samples

SDK 还提供 TypeScript 示例,为方便起见,这些示例在此处列出。The SDK also provides TypeScript examples, listed here for your convenience.

示例Samples 说明Description
索引indexes 演示如何创建、更新、获取、列出和删除搜索索引Demonstrates how to create, update, get, list, and delete search indexes. 此样本类别还包括一个服务统计信息示例。This sample category also includes a service statistic sample.
dataSourceConnections(用于索引器)dataSourceConnections (for indexers) 演示如何创建、更新、获取、列出和删除索引器数据源,对于基于索引器为支持的 Azure 数据源编制索引而言,这些数据源是必需的。Demonstrates how to create, update, get, list, and delete indexer data sources, required for indexer-based indexing of supported Azure data sources.
索引器indexers 演示如何创建、更新、获取、列出、重置和删除索引器Demonstrates how to create, update, get, list, reset and delete indexers.
skillSetskillSet 演示如何创建、更新、获取、列出和删除技能组,这些技能组是附加的索引器,并且在编制索引期间执行基于 AI 的扩充。Demonstrates how to create, update, get, list, and delete skillsets that are attached indexers, and that perform AI-based enrichment during indexing.
synonymMapssynonymMaps 演示如何创建、更新、获取、列出和删除同义词映射Demonstrates how to create, update, get, list, and delete synonym maps.
查询Queries 演示如何针对 Microsoft 托管的只读公共索引执行查询。Demonstrates query execution against a read-only public index hosted by Microsoft.

文档示例Documentation samples

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

示例Samples 说明Description
quickstartquickstart 快速入门:在 JavaScript 中创建搜索索引的源代码。Source code for Quickstart: Create a search index in JavaScript.

独立示例Standalone samples

示例Samples 说明Description
azure-search-react-templateazure-search-react-template Azure 认知搜索的 React 模板 (github.com)React template for Azure Cognitive Search (github.com)