0

我有这种关系

供应商 -> 有很多产品

供应商均已编入索引,产品均已编入索引。我需要(老板想要)搜索供应商和所有供应商的产品并列出结果供应商。

这在 nhibernate.search/Lucene.NET 中可行吗?

4

1 回答 1

2

是的,有可能:http ://ayende.com/blog/3992/nhibernate-search

请参阅给定的示例,IndexEmbedded 属性意味着“子”对象或集合也将被索引:

[Indexed]
public class Post
{
    [DocumentId]
    public virtual int Id { get; set; }

    [IndexedEmbedded]
    public virtual Blog Blog { get; set; }

    [IndexedEmbedded]
    public virtual User User { get; set; }

    [Field(Index.Tokenized, Store = Store.Yes)]
    public virtual string Title { get; set; }

    [Field(Index.Tokenized)]
    public virtual string Text { get; set; }

    public virtual DateTime PostedAt { get; set; }

    public virtual ISet<Comment> Comments { get; set; }

    [IndexedEmbedded]
    public virtual ISet<Category> Categories { get; set; }

    [IndexedEmbedded]
    public virtual ISet<Tag> Tags { get; set; }
}
于 2011-06-09T06:50:54.170 回答