出处:https://doc.sitecore.com/developers/90/platform-administration-and-architecture/en/configure-azure-search.html#UUID-6db2d23d-88f1-df71-5144-82fd14c811d3_id__Create_a_Searchhtml
登录 the Azure portal, "All service" --> 输入 “search” -->选择“Search Services”web
在 “Search services”页面, 点击“Add”
windows
![]() |
在“New Search Service”页面:api
输入服务名称bash
选择合适的resource group, location, and pricing tierapp
Sitecore 须要 15 search indexes, 因此至少须要选择S Standard pricing tier. (译者:选择Basic也可,若是没有自定义的index正好够 )ide
![]() |
点 Create.ui
在建立好的Search Service中点Keys,能够找到Primary/Secondary admin key,稍后会在connection string中用到this
在 connection string 配置文件(一般在App_Config文件夹中)找到"cloud.search"(译者:若是没有,新建一个),应该包含以下信息
:搜索引擎
serviceUrl
– Search Service API的HTTPS URL (好比: https://dk-test.search.windows.net).
apiVersion
– follows a date format, for example, 2015-02-28 (译者:目前是2017-11-11,能够在Search Service的“Search Explorer”中的“Set API version”找到).
apiKey
– 上一步中提到的admin key,能够在Search Service的“Keys”中找到
Sitecore 8.2-Update 3 以及以后的版本默认使用 API version 2015-02-28-Preview.
Connection string 格式:
<add name="cloud.search" connectionString="serviceUrl=<url>;apiVersion=<apiVersion>;apiKey=<apiKey>" />
Sitecore 支持 geo-replicated Search Service:
创建两个或多个 Search service.
在connection strings 使用 | 做为分割符. 例如在一个geo-replicated scenario中使用两个search services:searchservice1 和searchservice2, 在connection string须要作如下配置:
<add name="cloud.search" connectionString="serviceUrl=https://searchservice1.search.windows.net;apiVersion=2015-02-28;apiKey=AdminKey1|serviceUrl=https://searchservice2.search.windows.net;apiVersion=2015-02-28;apiKey=AdminKey2" />
connection string 新建一条,好比 cloud.search.analytics
.
在index配置中使用新建的connect string值:
![]() |
Sitecore默认Solr做为搜索引擎,若是要使用Azure Search Service,须要以下更改(译者:如下步骤翻译自https://doc.sitecore.com/developers/90/platform-administration-and-architecture/en/configure-a-search-and-indexing-provider.html):
在 web.config
文件, 找到 <AppSettings>
"search:define"
setting,设置为Azure:
<AppSettings> <add key="search:define" value="Azure"/> </AppSettings>
使用admin登录Sitecore (http:// {your_instance}/sitecore/login)
"Control Panel" --> "Indexing manager".
选择全部 indexes,点击 Rebuild.
重建index消耗必定时间,可能须要 15 minutes 甚至更长
重建index以后,在Azure Search Service中能够看到:
![]() |
Azure Search使用 Entity Data Model (EDM) field types.
Mapping between .Net and Sitecore:
sitecore\contentsearch\indexConfigurations\defaultCloudIndexConfiguration\CloudTypeMapper\Sitecore.ContentSearch.Azure.DefaultIndexConfiguration.config
file.
对全部自定义的field须要定义map element:
<map type="<Field type>" cloudType="<Edm type from list of supported types>" />
Best Practice: listing all fields under the index configuration section
sitecore
\contentSearch
\configuration
\indexes
\index
\configuration
\fieldMap
Attribute |
Description |
---|---|
|
The name of the field, as defined for Lucene and Solr. |
|
The field name as defined for Cloud. It can only contain letters, numbers, and underscores. NoteThe first character must be a letter. |
|
Use the boost attribute to give one field more importance than another. |
|
You must configure this attribute for |
|
The |