如何查询添加为 IndexEmbedded 的数据?
我有一个实体类
[Indexed]
public class Something
{
[Field(Index.Tokenized, Store = Store.Yes)]
public virtual string Description { get; set; }
[IndexedEmbedded]
public virtual Category Category { get; set; }
[IndexedEmbedded]
public virtual Location Location { get; set; }
}
位置为
[Indexed]
public class Location
{
/// </summary>
[Field(Index.Tokenized, Store = Store.Yes)]
public virtual string Address
{
}
数据被添加到索引中(包括普通属性和 IndexEmbedded),我可以使用 Luke 看到它们。
但是,当我使用全文查询时,我只得到正常属性的有效结果,而不是IndexedEmbedded
例如 “样本描述” => 1 个结果,“帕洛阿尔托” => 0 个结果(它们都在索引中)
这是我的查询
using (IFullTextSession s = Search.CreateFullTextSession(NHibernateSession.GetSession())) {
MultiFieldQuerParser qp = new MultiFieldQueryParser(new[] {
“Description”,“Title”,”Name”
}, new StandardAnalyzer());
IQuery NHQuery = s.CreateFullTextQuery(qp.Parse(query), typeof(Something));
result = NHQuery.List();
我做错了什么或遗漏了什么吗?