Supported methods and operators for xConnect search
xConnect search does not implement all of IAsyncQueryable<T> methods and throws a Sitecore.XConnect.Search.YourLinqIsTooStrongException or an XdbModelException exception if you try to use a method that is not supported. The following table applies to both contact and interaction searches unless explicitly stated.
Refer to the xConnect Client API for an overview of synchronous and asynchronous extension methods.
Extension method and operator support matrix:
| Method/Operator | xConnect | IAsyncQueryable | Notes |
|---|---|---|---|
.Where() | Yes | Yes | |
.Any() | Yes | Yes | |
.ToArray() | Yes | Yes | |
.ToList() | Yes | Yes | |
.Count() | Yes | Yes | |
.OrderBy() | Yes | Yes | |
.OrderByDescending() | Yes | Yes | |
.ThenBy() | Yes | Yes | |
.ThenByDescending() | Yes | Yes | |
.Skip() | Yes | Yes | See Paginating xConnect search results. |
.Take() | Yes | Yes | See Paginating xConnect search results. |
.FirstOrDefault() | Yes | Yes | |
.First() | Yes | Yes | |
.Single() | Yes | Yes | |
.SingleOrDefault() | Yes | Yes | |
== and != | Yes | Yes | |
< and > | Yes | Yes | |
<= and >= | Yes | Yes | |
&& and || | Yes | Yes | |
.GetBatchEnumerator() | Yes | No | |
.GetBatchEnumeratorSync() | Yes | No | |
.ToSearchResults() | Yes | No | |
.WithExpandOptions() | Yes | No | |
.AsEnumerable() | Yes | No | Synchronous only. |
Contains | No | Yes | |
StartsWith | No | Yes | |
EndsWith | No | Yes | |
ToString | No | Yes | |
Equals | No | Yes |
There is no Like() extension method.
xConnect search provider limitations
xConnect search providers do not support the following scenarios:
Limitations of xConnect search providers:
-
Scenario: Limitation
-
Custom methods inside search expressions: The xConnect Client API does not support custom method calls inside LINQ query expressions. You receive a
Sitecore.XConnect.Search.YourLinqIsTooStrongExceptionor anXdbModelExceptionexception. -
Search for null values: It is not possible to check if a facet is null. For example:
-
Search by Timespan in custom event properties: The following query (using a custom Timespan property) is unsupported
can still use the default Duration property on events. This restriction only applies to events, not facets. -
First, FirstOrDefault, Last, LastOrDefault, or Count inside a LINQ expression: Not supported:
-
Timespan: You cannot use Timespan with a query that combines the OfType operator AND a Timespan property (for example, Hours, Minutes, Seconds, and so on).Supported
supported: -
Repeated names in paths to complex lists: The following queries are unsupported because Path.To.Nested is the same for both lists: