我正在使用NHibernate.Search
和Lucene.Net
。我会问是否有人遇到过类似的问题。这是关于以下三个类的情况。
[Indexed]
public class File
{
[Field]
public virtual string FileId { get; private set; }
[ContainedIn]
public virtual List<Record> Records { get; private set; }
}
[Indexed]
public class CaseFile : File
{
[Field]
public virtual int CaseYear { get; set; }
[Field]
public virtual int CaseSequenceNumber { get; set; }
}
[Indexed]
public class Record
{
[IndexedEmbedded]
public virtual File ParentFile { get; set; }
}
问题是当我尝试索引记录类时。目标是获取索引中包含的File
类和子类的所有字段。但是当我索引该类时,我只能在我的记录索引中获得超类的字段。记录索引中缺少子类的字段。CaseFile
Record
Record
File
CaseFile
我也尝试过[IndexedEmbedded(TargetElement = typeof(CaseFile))]
on类ParentFile
中的属性Record
,但这会导致索引完全为空,或者根本没有索引。
如果我索引 File 类,则预期的子类属性将在索引中按预期进行File
索引。
有没有人遇到过类似的Hibernate/NHibernate
搜索问题?