翻譯 - Sitecore 9 Azure Search 配置

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

 

建立搜索服務

  1. 登錄 the Azure portal, "All service" --> 輸入 「search」 -->選擇「Search Services」web

     

  2. 在 「Search services」頁面, 點擊「Add」
    windows

    BDB3EA34893D4467B05236A811CA5DC0.png
  3. 在「New Search Service」頁面:api

    • 輸入服務名稱bash

    • 選擇subscription 
    • 選擇合適的resource group, location, and pricing tierapp

    Note

    Sitecore 須要 15 search indexes, 因此至少須要選擇S Standard pricing tier. (譯者:選擇Basic也可,若是沒有自定義的index正好夠 )ide

    5F3DBC6035294D57B6E4618E44688A54.png
  4. 點 Create.ui

  5. 在建立好的Search Service中點Keys,能夠找到Primary/Secondary admin key,稍後會在connection string中用到this

更新Connection String

在 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」中找到

Note

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:

    1. 創建兩個或多個 Search service.

    2. 在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" /> 

Best practice:每一個index使用專用的search service. :

    1. connection string 新建一條,好比 cloud.search.analytics.

    2. 在index配置中使用新建的connect string值:

3CED22D63B624CB2BFFE6CEDE59049B4.png

指定Azure做爲搜索引擎

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>

 

重建全部index

  1. 使用admin登錄Sitecore (http:// {your_instance}/sitecore/login) 

  2. "Control Panel" --> "Indexing manager".

  3. 選擇全部 indexes,點擊 Rebuild.

    Note

    重建index消耗必定時間,可能須要 15 minutes 甚至更長

    重建index以後,在Azure Search Service中能夠看到:

    4B949D4B00C94DD1A55C849238DA8196.png

Map the Azure field types

Azure Search使用 Entity Data Model (EDM) field types

 

Mapping between .Net and Sitecore:

sitecore\contentsearch\indexConfigurations\defaultCloudIndexConfiguration\CloudTypeMapper\Sitecore.ContentSearch.Azure.DefaultIndexConfiguration.config file.

Note

對全部自定義的field須要定義map element:

<map type="<Field type>" cloudType="<Edm type from list of supported types>" /> 

Map fields

Best Practice: listing all fields under the index configuration section

  • sitecore\contentSearch\configuration\indexes\index\configuration\fieldMap

 

Attribute

Description

fieldName

The name of the field, as defined for Lucene and Solr.

cloudFieldName

The field name as defined for Cloud. It can only contain letters, numbers, and underscores.

Note

The first character must be a letter.

boost

Use the boost attribute to give one field more importance than another.

format

You must configure this attribute for DateTime type fields. The supported value is yyyy-MM-ddTHH:mm:ss.fffZ.

settingType

The settingType property must be:Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure

相關文章
相關標籤/搜索