我想在我的應用程序中使用hibernate搜索(lucene)實現搜索功能。簡單搜索字符串字段的工作是完美的,但現在事情變得更加複雜.... 我希望你能給我一些提示或樣本。休眠lucene搜索集合和枚舉
我有以下實體...
@Entity
@Indexed
public class ChildClass {
@Enumerated
@Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
private EnumType enumType;
....
//getter setter
}
=============================== =========
@Entity
@Indexed
public class ParentClass {
@IndexEmbeded
List<ChildClass> childs;
//getter setter...
}
================================== ======
public enum EnumType {
a,b,c
}
===================================== ==
現在,我嘗試搜索和查找,例如:
「找到具有孩子的ParentClasses的一個List,child.enumtype =一個」
我可以用HQL或原生SQL查詢做到這一點。但是如何用hibernate lucene查詢來做到這一點。
在此先感謝
爲澄清: – user2439522
只是爲了澄清 對於地圖例如 \t @Field(index = Index.YES,analyze = Analyze.YES,store = Store。NO) @IndexedEmbedded(depth = 1) private Map comments; \t 我可以使用查詢像: luceneQuery = queryBuilder.keyword()通配符()onField( 「註釋」)匹配( searchString的).createQuery();。 booleanJunction.should(luceneQuery); \t \t \t 這qurey返回結果如預期。 我有上述用例的問題 –
user2439522