This project is read-only.

Querying for content items with similar features associated with different terms across a taxonomy

Topics: Customizing Orchard
Nov 22, 2012 at 9:29 PM

I am using Orchard to present documentation for a range of products. The documentation for different features and versions of the products is generated outside of Orchard, so I am working to build a module that allows an admin to import the documentation and turns the imported documentation files (HTML) into content items that can be managed and published on Orchard.

I'm using the taxonomy module to provide structure for the documentation. So, after importing a couple of sets of documentation files, the taxonomy structure might be constituted in this way: 

Products (Taxonomy)

- Product 1 (Term)

-- Version 1 (Term)

--- Feature A (Term)

---- DocumentationFeatureA (Content item)

-- Version 2 (Term)

--- Feature A (Term)

---- DocumentationFeatureA (Content item)

The Documentation content type will consist of a taxonomy field, a title part, and a custom content part with the imported HTML to be rendered as a property (along with a few other properties). 

On each documentation content item that is rendered, I would like to display a drop-down list or some such widget that will contain a list of links to documentation for the same feature from other versions of the product (if they exist). So, DocumentationFeatureA (Version 2) would contain a link to DocumentationFeatureA for Version 1, and vice-versa. 

I am not certain how best to generate and display this list of links. My initial thinking is to use ITaxonomyService to get the TermPart and associated taxonomy ID for a given documentation content item, query for different version TermParts, check for a child TermPart with the same feature name, and if it exists, check for a documentation content item associated with it of the same name. I suspect that there are much better ways of accomplishing this task, and I would appreciate suggestions on how to do so. Thanks. 

Nov 23, 2012 at 3:00 AM
Edited Nov 23, 2012 at 3:01 AM

I don't see an obviously better way of doing that.

Or maybe you need to split that taxonomy in two: version and feature. Then you can query each independently.

Nov 24, 2012 at 4:17 AM

I'm not sure if the taxonomy structure I specified above would be valid anyway, because there are two terms listed with the same name of "Feature A", although they are children of different parent terms. One issue I see with having two taxonomies, one for version and one for feature, is that I would like to create a hierarchical menu that is organized like the taxonomy structure above, but I don't know how I would be able to incorporate the two taxonomies to do so.