果园按分类获取内容

本文关键字:获取 分类 果园 | 更新日期: 2023-09-27 18:04:10

我正在尝试通过分类获得一些内容,这是该内容的一部分/这是我所拥有的:

var taxonomyTerms = _taxonomyService.GetTerms(taxonomy.Id).Where(t =>      termsToSearch.Contains(t.Name)).ToList();
var listOfTermsIds= taxonomyTerms.Select(x => x.Id).ToList();
//works well until here, I have my list of terms ids
var originalContentItems = _cm
.Query<GenericContentPart, GenericContentRecord>()
.Join<TermsPartRecord>().Where(l => !l.Terms.Select(t => t.TermRecord.Id).Except(listOfTermsIds).Any()).List();
//this returns no records

我已经设法用foreach做到了这一点,但我想用表达式做同样的事情。问题是最后一位代码没有返回给我任何记录。

帮忙吗?

果园按分类获取内容

我发现问题了:

contentItems = _cm
.Query<GenericContentPart, GenericContentRecord>()
.Join<TermsPartRecord>().ForPart<TermsPart>().List()
.Where(l => !listOfTermsIds.Except(l.Terms.Select(t => t.TermRecord.Id).ToList()).Any());

谢谢。