簡體   English   中英

hibernate搜索中lucene查詢中的集合投影

[英]Projection of Collections in lucene query in hibernate search

我正在嘗試使用@IndexEmbedded批注進行索引。 當我使用Luke檢查時結果是正確的。(我得到了List的所有元素)。

但是當我嘗試在Lucene Query中使用此列表進行投影時,我得到了null。

我在某處讀到“投影不適用於通過@IndexedEmbedded索引的集合或地圖”

是否有任何其他方法來預測此列表。

  @Indexed
public class Item {

   ...

  @IndexedEmbedded
  private List<Keyword> keywords;

   ...
}

@Indexed
public class Keyword {

   ...

  @Field
  private String value;

   ...
}

是的,根據文件:

you can only project simple properties of the indexed entity or its embedded associations. This means you cannot project a whole embedded entity.

projection does not work on collections or maps which are indexed via @IndexedEmbedded

可以嘗試通過對文檔中的實際關鍵字的順序和內容進行編碼來為關鍵字實現自定義雙向字段橋。 不知道這是不是一個好主意。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM