问题
Using Nhibernate.Search at the moment.
Some code for context:
[Indexed]
class foo {
[DocumentId]
int id {get;set;}
bar bar {get;set;}
}
[Indexed]
class bar {
[DocumentId]
int id {get;set;}
}
Question:
How to retrieve all foos where foo.bar.id==1 using IFullTextQuery?
回答1:
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>();
回答2:
Seems that [IndexedAttribute] is an answer.
来源:https://stackoverflow.com/questions/2295139/lucene-join-how-to