Sorting a projected query based on whether a post has a specific tag

Topics: General
Dec 10, 2013 at 8:46 AM

I have a projection that displays results from a query to sort a list of content items descending by publication date.

It is also a requirement that the content items within this query that have been tagged (using the Orchard.Tags module) with the word "sticky" to appear at the top of the results.

I've looked into implementing a custom sort provider using the ISortCriterionProvider interface but it looks as if i can only sort by a property, rather than on the property containing a specific value.

Is there any way to do this?

Here is my ApplyFilter method as it currently stands:
public void ApplyFilter(SortCriterionContext context)
    Action<IAliasFactory> selector = alias => alias.ContentPartRecord<TagsPartRecord>().Property("Tags", "tags").Property("TagRecord", "tagRecord");
    Action<IHqlSortFactory> filter = x => x.Asc("TagName");
Dec 10, 2013 at 11:00 AM
I would like to know if there is an answer for this question as well. In the meantime, you might want to use a property, value of which is assigned to some integer value on update (or publish maybe), 1 for tagged with "sticky" and 100 for not.