Support reference for Azure Search

Last updated Monday, November 13, 2017 in Sitecore Experience Platform for Administrator, Developer
Keywords: Azure

This topic references the different types of support for Azure Search, including Query support and Facet support. Configure Azure Search in conjunction with this reference topic.

Query support

Sitecore Azure Search provides mapping capabilities from LINQ to queries that are supported by the Microsoft Azure Search API.

At the moment, the Azure Search service supports two types of query syntax, Lucene and OData.

The Lucene query syntax is used for:

  • Field-scoped queries
  • Regular expression searches
  • Wildcard searches

The OData query syntax:

  • Can filter scenarios for non-searchable data types, such as int or dateTime, for example.
  • Is used for comparisons.
  • Is contained within collections.
  • Uses unary operators.

The Sitecore Azure Search provider covers most of the query scenarios available for Lucene, here are the most commonly used ones:

Query scenario

Example

Field scope searches

from d in queryable where d.Name.Contains("Sitecore") select d 
from d in queryable where d.Name.Like("Sample Item") select d 
from d in queryable where d.Name == "Sample Item" select d 
from d in queryable where d.Name.Matches("Sample.*") select d

Logical operators

(including, &, Or, Not, and Between)

from d in queryable where d.Name.Contains("Sitecore") && d.Price > 100 select d 
from d in queryable where d.Price.Between(1000, 2000, Inclusion.Both)select d 

Ordering

from d in queryable where d.Name.Like("Sample Item") orderby d.Id select d 

Boosting

from d in queryable where d.Name.Like("Sample").Boost(2f) || d.Template.Like("Sample") select d 

Searching within collections

from d in queryable where d.TemplateIds.Contains(Sitecore.TemplateIDs.Layout) select d 

Important

You must not apply queries such as StartsWith, Contains to fields with of type EDM.String that contain paths (such as /sitecore/content/home) or collections of GUIDs. This is because Azure Search matches regular expression searches to single words.

Features that are not currently supported include:

  • Joins, for example, GroupJoin, Join, SelfJoin.
  • Queries with predicates of both Lucene and OData syntax that are joined or are an operand, for example:
    from d in queryable where d.Name.Contains("Sitecore") || (d.Price > 1000) select d) 

Facets support

Sitecore Azure Search provides mapping capabilities from the Content Search facet API to queries that are supported by the Microsoft Azure search API.

The currently supported features include:

Feature

Example

Build facets

queryable.FacetOn(x => x.Country).GetFacets()

Build facets in a single request

queryable.FacetOn(x => x.Country).FacetOn(x => x.Brend).FacetOn(x => x.Price).GetFacets()

Filter values to facet

queryable.FacetOn(x => x.Country, null, new {"Denmark", "Germany"}).GetFacets()

Exclude terms by the minimal count of documents

queryable.FacetOn(x => x.Country, 10).GetFacet()

The query will return terms that contain more than 10 documents.

Important

You cannot use this feature to increase performance because it is only supported on the client side.

Limit the count of terms in a facet

The provider returns 10 terms per facet by default. You can set the limit in: sitecore/contentSearch/configuration/indexes/index/maxTermsCountInFacet

Note

Currently all pivot facets are not supported; they are excluded from requests and ignored.

Send feedback about the documentation to docsite@sitecore.net.