Lucene“加入"方法? [英] Lucene 'join' how-to?

查看:98
本文介绍了Lucene“加入"方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Nhibernate.此刻进行搜索.

Using Nhibernate.Search at the moment.

一些上下文代码:

[Indexed]
class foo {
  [DocumentId]
  int id {get;set;}
  bar bar {get;set;}
}

[Indexed]
class bar {
  [DocumentId]
  int id {get;set;}
}

问题:
如何使用IFullTextQuery检索foo.bar.id == 1的所有foos?

Question:
How to retrieve all foos where foo.bar.id==1 using IFullTextQuery?

推荐答案

如果要将相关信息包含在foo索引中,则可以查看IndexedEmbeddedAttribute.这将允许您查询关系,例如在条对象上是否存在Name属性,您可以创建这样的查询

If you want to include related information into the foo index you may look into the IndexedEmbeddedAttribute. This will allow you to query for relationships such as if there was a Name property on the bar object you could create a query such as this

IFullTextQuery query = search.CreateFullTextQuery("bar.Name:Arnis");
query.List<foo>();

这篇关于Lucene“加入"方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆