We're updating the issue view to help you get more done. 

indexEmbedded depth parameter shared across class

Description

When marking a class with multiple @IndexEmbedded annotations, the depth variable is assigned at the class-level instead of the field-level.

1 2 3 4 5 6 7 8 9 public class MyTest() { @IndexEmbedded private Set<MyClass> myClass; @IndexEmbedded(depth=1) private Set<MySecondClass> myClass2; }

In looking at the source code for HibernateSearch, the AnnotationMetadataProvider's checkForIndexedEmbedded() method appears to share the parseContext across all fields within the class ( https://github.com/hibernate/hibernate-search/blob/d6f1ba9909857b967c17e32ea6289ab7909a9a51/engine/src/main/java/org/hibernate/search/engine/metadata/impl/AnnotationMetadataProvider.java#L1081) and set the maxLevel() there. Without stepping through the entire codebase, it would appear that this would cause the issue we're seeing whereby the depth is being set for all properties on the class (or possibly the entire parse tree) instead of just for that field.

Environment

None

Status

Assignee

Fabio Massimo Ercoli

Reporter

adamb

Labels

Components

Fix versions

Affects versions

4.4.0.Final
4.4.1.Final

Priority

Major