Does all sitecore fast query start at the Sitecore root, or can I get it to execute from the context of the item using it? I'd like to be able to specify a relative path as a field source in a template, to allow paral开发者_JAVA技巧lel editions of a site.
Fast Queries need to be ran from the database context. A fast query is actually translated into a SQL query whereas the traditional "query" is actually an XPath query so it can be provided with a context node to run from.
Answering my own question:
I can't find any way of getting fast query to operate from the context of the item, and several suggestions on various blogs and forums suggest this isn't possible. If this is the case then I'd be pleased if someone could confirm it for me.
But: standard Sitecore Query works perfectly well for relative queries (and in the case above I don't require the query to be executed for rendering in a live website, but for building the data structure of the site), using the standard .
to reference the context item.
So
query:./../Courses/*
Works to select children of a sibling of the context item named "Courses" while
fast:./../Courses/*
returns a syntax error.
精彩评论