翻译 - 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

相关文章
相关标签/搜索