如何在 RavenDB 客户端 api 中使用子 collections 属性进行搜索

How to search with sub collections properties in RavenDB client api

正如标题所说,我想知道如何使用来自 RavenDB C# 客户端 API 的 Session.Query.Search(...) 在 属性 中进行全文搜索collection 是实体的 属性。

public class Order
{
    public List<Product> Products { get; set; }
}

public class Product
{
    public string Name { get; set; }
}

在纯 RQL(raven 查询语言)中,查询将是这样的:

from Orders where search(Products.Name, '*alice*')

来自客户api, 使用 静态索引 定义可搜索的文档字段。

之后,您可以查询该索引字段并获取包含您在该索引字段中搜索的术语的文档。

参见示例: https://demo.ravendb.net/demos/csharp/text-search/fts-with-static-index-single-field