1

I have faced an issue with fast queries in Sitecore 10.1.

When I execute SelectSingleItem fast query:

 Database.GetDatabase("master").SelectSingleItem($"fast:/sitecore/system/Modules//*[@@templateid='{Constants.Templates.DemoModule}']");

I get the following error:

Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Kernel
   at Sitecore.Data.DataProviders.CompositeDataProvider.TransformQuery(String query, Boolean& allowMerging, String& filterPathId)
   at Sitecore.Data.DataProviders.CompositeDataProvider.SelectIDsInternalFast(String query, Boolean singleItemQuery, CallContext context)
   at Sitecore.Data.DataProviders.CompositeDataProvider.SelectSingleID(String query, CallContext context)
   at Sitecore.Data.DataProviders.DataProvider.SelectSingleID(String query, CallContext context, DataProviderCollection providers)
   at Sitecore.Data.DataManager.SelectSingleItem(String query, Boolean& processed)
   at Sitecore.Data.DefaultDatabase.SelectSingleItem(String query)

It works fine if I remove "fast:" prefix in query. Fast queries also work fine in previous Sitecore versions (tested in all 9.0-10.0).

The problem is that it is a bad idea to change all queries in project. Is there any solution without project refactoring?

4

1 Answer 1

4

Fast:// Query is not supported in Sitecore 10.1 and onwards.

Sources: http://www.stockpick.nl/english/the-end-of-sitecore-fast-query/

Official Source: https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/101/Sitecore%20Experience%20Platform%20101/Release%20Notes#Highlights

Sitecore Experience Platform 10.1.0 includes:

  • ​You can now use the content hierarchy to assign a behavior profile to multiple items. ​​- You can now use content tags to assign a behavior profile to multiple items.​
  • The Collection database now supports scalable reads.
  • You can now use the new ​Data Purge CLI tool to remove unwanted contact data from the Experience Database​.
  • Sitecore Fast Query has been deprecated.

[...] and more

1
  • 1
    Thank you! I didn`t know that.
    – x3mxray
    Commented Jun 14, 2022 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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