4

I'm using 8.2 Update-3 with the Azure Toolkit 1.1, deployed to Web App. I've got a template with a Date field on it, and I took a search class that works with Lucene and Solr like this:

[IndexField("date start")]
public DateTime DateStart { get; set; }

And the query expression:

DateTime time;
// ...
.Where(i => i.DateStart >= time)
.OrderBy(i => i.DateStart);

When I run this with Azure Search I get this exception:

System.NotSupportedException: The constant part of the 'GreaterThanOrEqualNode' was expected to be of type 'System.DateTimeOffset', but was of type 'System.DateTime'.

So I converted my result class property and time variable to DateTimeOffset. Then I got this exception instead:

Sitecore.ContentSearch.Azure.Http.Exceptions.AzureSearchServiceRESTCallException: {"error":{"code":"","message":"Invalid expression: Unsupported function call: search.ismatchscoring. This function is not supported in this API version.\r\nParameter name: $filter"}}

And this one:

System.NotSupportedException: IndexFieldUtcDateTimeOffsetValueConverter cannot convert from System.DateTime. at System.ComponentModel.TypeConverter.GetConvertFromException(Object value) at System.ComponentModel.TypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) at Sitecore.ContentSearch.Azure.Converters.CloudIndexFieldStorageValueFormatter.ReadFromIndexStorageBase(Object indexValue, String fieldName, Type destinationType)

Am I doing date mapping wrong or is this just a limitation of the Azure Search provider or service?

Edit: found the actual search expression in App Insights:

ERROR Azure Search Error [Index=sitecore_web_index] 
ERROR:Error in the request URI, headers, or body Search expression:&search=language_1:(en)&$filter=not search.ismatchscoring('name__:(__Standard Values)', null, 'full', null) and date_start ge 2017-05-17T04:55:13.340Z and (templatesimplemented__/any(t:t eq '{DFFD8BFE-9C7E-4033-AD70-6C600088A9E6}')) and latestversion_1&queryType=full

Weirdly, the unsupported ismatchscoring is apparently coming from .Where(i => i.Name != Sitecore.Constants.StandardValuesItemName) and not the date.

3

Regarding the ismatchscoring error, this is the cause - apparently the default settings for Azure Search rely on an old preview version of the Azure Search API:

  <!--  USE ISMATCHSCORING
        Determines if Azure Search provider uses ismatchscoring() function to build complex search expressions. 
        This function is available in version 2015-02-28-Preview of Azure Search API and is not available in version 2016-09-01 or earlier versions. 
        When using Azure Search API version 2016-09-01 or earlier versions, this setting must be changed to false. 
        Changing the value to false will limit the support for complex search queries.

        Default value: true
  -->
  <setting name="ContentSearch.Azure.UseIsMatchScoring" value="true"/>

Changing this to false resolved that exception.

| improve this answer | |
  • 1
    Either way, that documentation contradicts itself. Unless it was available, unavailable, and then available again ;-) – Steve McGill May 17 '17 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.