出處: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 |