It works after I make the following changes. I'm not sure if it would work for collections but you could try and post your results.
Ideally I would expect depth=2 in Class A to work but for some reason I have to define the depth in Class B. May be I don't understand the usage of depth.
To answer my other question, other classes(B &C ) need not have @Indexed.
Hope it helps others using hibernate search.
Code:
@Indexed
Class A
{
@ManyToOne
@IndexedEmbedded
B bObject;
}
Class B
{
@Field
String name;
@ManyToOne
@IndexedEmbedded(depth=1) /*** Modified ***/
C cObject;
}
Class C
{
@Field
String name;
@Field
String title;
}