[hibernate-dev] About mapping of @IndexedEmbedded and @DocumentId

Sanne Grinovero sanne at hibernate.org
Mon Mar 14 16:26:11 EDT 2011


Hello,
while debugging I just noticed that having a two entities scenario like

@Indexed class Book {
Long id;
@IndexedEmbedded Nation bublishedFirstIn;
}
Nation { //NOT indexed
Long id;
@Field name
}

the index for Book will contain these fields:

_hibernate_class  ------------- NOT_ANALYZED_NO_NORMS, STORED
id  ----------------------------------- NOT_ANALYZED_NO_NORMS, STORED
bublishedFirstIn.id ------------ NOT_ANALYZED, STORED
bublishedFirstIn.name ------ ok (don't care)

So, doubts:
1) I guess at minimum "bublishedFirstIn.id" should use
NOT_ANALYZED_NO_NORMS as well, saving some precious memory and index
space (see HSEARCH-473)

2) Why is "bublishedFirstIn.id" at all indexed? I can't think of a use
case, likely missing something.

3) (Extreme) why is "id" indexed ? Are we ever supposed to run a full
text query on the id fields? I think we should have an option about
this, and in future default to Store only.

Cheers,
Sanne



More information about the hibernate-dev mailing list