Everything I Learned About Sitecore Query From the Official Training

It wasn't much

October 5, 2016

Below are my actual notes from the training:

  • Sitecore Query allows you to interrogate an XML representation of the Sitecore tree
  • Primarily used to limit field selection via the field’s source
  • Sitecore Query and Sitecore Search are DIFFERENT
  • Sitecore Query is not intended for complex filtering or for returning a large number of results
  • Sitecore Query is best used in the context of a field’s source (such as multi-list, droplink, or checklist fields), or when you are dealing with a small set of items
  • You can use Sitecore Query in the API
  • Any complex searching should always be done with Sitecore Search
  • Sitecore Query, if used incorrectly, is a common culprit for serious performance issues
  • Sitecore Query is similar to XPath. It is primarily used to limit field selection in the field’s source
  • The XPath builder lets you test your queries quickly
  • Sitecore seems to have made the XPath builder tricky to navigate to, but I find the easiest way to launch is with commandy (CTRL+SHIFT+SPACE)
  • Expression example: /sitecore/content/Home//*[@#Main Heading# = ‘Spot’]
  • In some locations you'll need to append 'query:' in front of the query itself
  • The hashes explicitly state that there are spaces
  • There are relative and explicit queries

Hope that helps!

Marcel