Fixing projection filters for Tags and Comments

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-02-21 15:08:42 -08:00
parent ee3122ae16
commit 71831e6837
2 changed files with 4 additions and 4 deletions

View File

@@ -28,8 +28,8 @@ namespace Orchard.Comments.Projections {
}
public void ApplyFilter(dynamic context) {
var query = (IContentQuery<ContentItem>)context.Query;
context.Query = query.Where<CommentsPartRecord>(x => x.CommentPartRecords.Any());
var query = (IHqlQuery)context.Query;
context.Query = query.Where(x => x.ContentPartRecord<CommentsPartRecord>(), x => x.IsNotEmpty("CommentPartRecords"));
}
public LocalizedString DisplayFilter(dynamic context) {

View File

@@ -34,8 +34,8 @@ namespace Orchard.Tags.Projections {
string tags = Convert.ToString(context.State.TagIds);
if (!String.IsNullOrEmpty(tags)) {
var ids = tags.Split(new[] { ',' }).Select(Int32.Parse).ToArray();
var query = (IContentQuery<ContentItem>)context.Query;
context.Query = query.Join<TagsPartRecord>().Where(x => x.Tags.Any(t => ids.Contains(t.TagRecord.Id)));
var query = (IHqlQuery)context.Query;
context.Query = query.Where(x => x.ContentPartRecord<TagsPartRecord>().Property("Tags", "tags"), x => x.In("TagRecord.Id", ids));
}
}