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"}})