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.

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

Activity

Show:
adamb
December 14, 2013, 2:11 PM

Hardy, I was able to temporarily fix our use-case by setting our depth=2 instead of 1. At this point we're on a development branch with 4.4.0/4.4.1 and expect to be for a while. Even said, I think we should be okay even putting this into production if a fix isn't there.

I'm glad my reading of the code parallels yours. Sorry for not including a test case.

Marc Schipperheyn
December 14, 2013, 4:28 PM

I would recommend also taken this problem into consideration when rewriting the algorithm:

Yoann Rodière
May 7, 2019, 8:33 AM

This is very likely fixed in Search 6, probably also in Search 5. We need a test case in Search 5 and 6 just to be sure.

Fabio Massimo Ercoli
May 31, 2019, 10:16 AM

For Hibernate Search 6: Added the test for it. It already works.

Fabio Massimo Ercoli
May 31, 2019, 3:22 PM

Same for Hibernate Search 5. Added the test for it. It already works. So this issue can have `5.11.2.Final` as fixed version too.

Assignee

Fabio Massimo Ercoli

Reporter

adamb

Labels

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Affects versions

Priority

Major
Configure