このコンテンツは選択した言語では利用できません。
4.3. Embedded and Associated Objects
Associated objects and embedded objects can be indexed as part of the root entity index. This allows searches of an entity based on properties of associated objects.
4.3.1. Indexing Associated Objects リンクのコピーリンクがクリップボードにコピーされました!
リンクのコピーリンクがクリップボードにコピーされました!
The aim of the following example is to return places where the associated city is Atlanta via the Lucene query
address.city:Atlanta. The place fields are indexed in the Place index. The Place index documents also contain the following fields:
address.idaddress.streetaddress.city
These fields are also able to be queried.
Example 4.4. Indexing associations
@Indexed
public class Place {
@Field
private String name;
@IndexedEmbedded( cascade = { CascadeType.PERSIST, CascadeType.REMOVE } )
private Address address;
....
}
public class Address {
@Field
private String street;
@Field
private String city;
@ContainedIn(mappedBy="address")
private Set<Place> places;
...
}