RavenDB (4.0-beta):如何全文​​搜索动态属性

RavenDB (4.0-beta): How to full-text-search dynamic attributes

我想使用 RavenDb 4.0.0-beta-40018 查询包含动态属性的实体,但不确定如何执行此操作。

class Foo {
    public int Id { get; set; }
    public DateTime CreatedAt { get; set; }
    public string Name { get; set; }
    public dynamic Attributes { get; set; }
}

{
    "Attributes": {
        "IsFeatured": true
    },
    "CreatedAt": "2017-08-30T15:53:21.1881668Z",
    "Name": "Featured Foo"    
}

这是我尝试使用的查询。

const string propertyName = "IsFeatured";

var results = session.Query<Foo>()
        .Where(x => x.Attributes != null)
        .Where(x => x.Attributes[propertyName] != null)
        .Where(x => x.Attributes[propertyName] == true);

遗憾的是,我什至无法编译此代码,因为出现编译错误 (Error: An expression tree may not contain a dynamic operation)。
我不认为这是在动态属性中搜索(使用 ravendb)的好方法。有没有更好的方法?

应该这样做:

DocumentSession.Advanced.DocumentSession<Foo>()
  .WhereEquals("Attributes.IsFeatured", true)
  .ToList()