U4-8720 - ITypedPublishedContentQuery needs to support GUID id lookups

Created by Shannon Deminick 11 Jul 2016, 12:49:07 Updated by Warren Buckley 21 Jul 2016, 14:49:01

Tags: Star

Relates to: U4-8741

Relates to: U4-8742

Currently we can only query IPublishedContent by INT ids, but we need to be able to query (fast) by it's GUID id too


Umbraco 18 Jul 2016, 12:06:16

Other things we need to support:

  • Site extension method for typed content
  • Another extension method that is missing is Children("ContentTypeAlias") on IPublishedContent, we have this for DescendantsOrSelf, why not children? seems strange and it exists on dynamics.

Stephan 19 Jul 2016, 10:13:51

what's a "site extension method" again?

Shannon Deminick 19 Jul 2016, 10:20:19

It's an extension method on DynamicPublishedContent called Site() - you'll find it. It does just AncestorOrSelf(1) IIRC. It traverses up to find the current node's 'Site' node.

Stephan 19 Jul 2016, 10:21:57

Ah ok.

Stephan 19 Jul 2016, 10:59:05

Querying by guid for content has to be implemented with XPath, that can be done in PublishedContentQuery in a simple way. For media it has to be implemented with Examine and that needs to be done in the media cache itself. Meaning we would need to change the signature of IPublishedCache to add (at least) a new GetById(guid) method.

I'd rather just do content, without changes to IPublishedCache, in 7.5 - and see what we can do to optimize + media in 7.6. Thoughts?

Shannon Deminick 19 Jul 2016, 11:15:29

Yup that sounds reasonable

Stephan 19 Jul 2016, 11:27:10

Created U7-8741 for 7.6 and U7-8742 for 8.0.

Stephan 19 Jul 2016, 14:13:55

PR: https://github.com/umbraco/Umbraco-CMS/pull/1388

Adds .Site(), .Children("alias1", "alias2"...), and UmbracoHelper .Content and .TypedContent methods accepting guids.

Stephan 19 Jul 2016, 14:14:04

ready for review

Warren Buckley 21 Jul 2016, 11:11:26

Code reads perfectly fine @zpqrtbnk but I am gonna be nit-picky & ask for XML inline docs please as we are generating documentation from these automatically, so that we all start to get in a better habit & being mindful to create docs, so setting as Reopened for now.

Stephan 21 Jul 2016, 13:21:27

have added doc to all new/modified methods that are visible to users is that ok?

Warren Buckley 21 Jul 2016, 14:48:56

Lovely thanks :)

Priority: Normal

Type: Feature (request)

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.5.0

Sprint: Sprint 38

Story Points: