Sitecore 9 使用 Azure Search的几个知识点
Sitecore 的patch config文件(通常在app config的Include文件夹中) 使用role:require和search:require,不需要disabled文件后缀名了
写Index的时候,Azure Search要求Field Name必须存在于Schema中( Error Message: Job started: Index_Update_IndexName=bvp_web|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AggregateException: One or more errors occurred. ---> Sitecore.ContentSearch.Azure.Http.Exceptions.BadRequestException: Error in the request URI, headers, or body ---> Sitecore.ContentSearch.Azure.Http.Exceptions.AzureSearchServiceRESTCallException: {"error":{"code":"","message":"The request is invalid. Details: parameters : The property 'c_wbv_09ca13d3cec94069a2678c8573475c1c_tf' does not exist on type 'search.documentFields'. Make sure to only use property names that are defined by the type.\r\n"}})
动态写Field的时候,比如在程序中创建一个新的Field(x_GUID_s),可以override CloudSearchDocumentBuilder,使用SchemaBuilder加入动态Field的定义,然后再写入document就没有问题了
Field的Type如果是System.Double是不能定义成 searchable和facetable的(Error Message: {"error":{"code":"","message":"The request is invalid. Details: definition : The searchable field 'c_www_tf' must be of type Edm.String or Collection(Edm.String).\r\n"}})
Field的Type如果是System.String[]是不能定义成 sortable的(Error Message: {"error":{"code":"","message":"The request is invalid. Details: definition : The field 'c_answer_tag_68dc570c3d5d4044a2a66bad46137418_sm' cannot be enabled for sorting, as it is of a collection type.\r\n"}})