Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Orchardcms 仅将Orchard CMS中的标记筛选到博客_Orchardcms_Tag Cloud - Fatal编程技术网

Orchardcms 仅将Orchard CMS中的标记筛选到博客

Orchardcms 仅将Orchard CMS中的标记筛选到博客,orchardcms,tag-cloud,Orchardcms,Tag Cloud,在Orchard CMS中,我试图找到一种方法来过滤标签云中的标签,以便仅从博客帖子返回标签。现在,标记云返回所有内容类型的标记 我正在使用Orchard 1.7.1中的默认标记云 如果在admin中有设置,很好,如果没有,我在TagCloudService.cs中找到了一个查询。这是我需要编辑的吗。如果是这样的话,有人能帮我在这里添加只包含博客文章的过滤器吗 tagCounts = _contentManager .Query<TagsPart, Tags

在Orchard CMS中,我试图找到一种方法来过滤标签云中的标签,以便仅从博客帖子返回标签。现在,标记云返回所有内容类型的标记

我正在使用Orchard 1.7.1中的默认标记云

如果在admin中有设置,很好,如果没有,我在TagCloudService.cs中找到了一个查询。这是我需要编辑的吗。如果是这样的话,有人能帮我在这里添加只包含博客文章的过滤器吗

tagCounts = _contentManager
                .Query<TagsPart, TagsPartRecord>(VersionOptions.Published)
                .Join<CommonPartRecord>()
                .Where(t => t.Container.Id == containerId)
                .List()
                .SelectMany(t => t.CurrentTags)
                .GroupBy(t => t)
                .Select(g => new TagCount {
                    TagName = g.Key,
                    Count = g.Count()
                })
                .ToList();
tagCounts=\u contentManager
.Query(VersionOptions.Published)
.Join()
.Where(t=>t.Container.Id==containerId)
.List()
.SelectMany(t=>t.CurrentTags)
.GroupBy(t=>t)
.选择(g=>新标记计数{
标记名=g.键,
Count=g.Count()
})
.ToList();

谢谢

将对
Query
的调用替换为
.Query().ForPart().ForType(“BlogPost”).ForVersion(VersionOptions.Published)。Join()

我对过滤器有额外的要求。博客文章有3个分类字段,与这里的教程类似。如何根据分类字段包含筛选器。e、 例如,博客文章有一个分类字段,即文章类型。我只想在标签云中返回特定文章类型的博客文章中的标签。这是一个新问题。我认为您必须为此切换到Hql查询,并查看分类模块的服务类源代码,以了解它们是如何执行此类查询的。