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

Emmanuel Bernard emmanuel at hibernate.org
Tue Mar 15 05:56:22 EDT 2011


Are you talking about JPA entities (with @Entity and @Id or mere mortal POJOs?

On 14 mars 2011, at 21:26, Sanne Grinovero wrote:

> 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
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev





More information about the hibernate-dev mailing list