4
votes

Started using the query analyzer in sitecore recently, but I am wondering if there is a way to dig deeper than querying by id, name, template, path, etc.

Such as querying by item["mycustomerfield"] = 'something specific'. sitecore rocks is in ctp and the documentation is still coming around.

1

1 Answers

10
votes

You can do lots of things with the Query Analyzer.

John West has a nice introduction here.

Other than that, using the Help keyword can give you some pointers. If you type help select you get some detailed help on the select keyword - including the EBNF syntax.

You can also use the scripting commands from the Sitecore Explorer: Tools | Script | Select.

Here are an example:

Select Title and Text fields from all items under /sitecore/content that uses the Sample Item template.

select @title, @text from /sitecore/content//*[@@templatekey = 'sample item']

Notice the @@ before the system attribute templatekey.

Other than that you should be familiar with identifier escaping. Since Sitecore field names may contain spaces, you have to enclose them in ##.

This selects the field Long Text from home:

select @#Long Text# from /sitecore/content/Home