Uploaded image for project: 'Hibernate Search'
  1. Hibernate Search
  2. HSEARCH-2547

Nesting @IndexedEmbeddeds with "includePaths" results in invalid path restrictions

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5.0.Final, 5.5.6.Final, 5.6.0.CR1
    • Fix Version/s: 5.6.0.Final, 5.5.7.Final, 5.7.0.CR1
    • Component/s: mapping
    • Labels:
      None

      Description

      For instance:

      	@Entity
      	@Indexed
      	private static class A {
      		@Id
      		@GeneratedValue
      		private Long id;
      
      		@Field(analyze = Analyze.NO)
      		private String foo;
      	}
      
      	@Entity
      	private static class B {
      		@Id
      		@GeneratedValue
      		private Long id;
      
      		@OneToOne
      		@IndexedEmbedded(includePaths = "foo") // Include only "a.foo"
      		private A a;
      	}
      
      	@Entity
      	@Indexed
      	private static class C {
      		@Id
      		@GeneratedValue
      		private Long id;
      
      		@OneToOne
      		@IndexedEmbedded // Include every field of "b"
      		private B b;
      	}
      

      This will not include b.a.foo in the resulting document for C, even though we would think so (since the @IndexedEmbedded in C doesn't mention any restriction on what to embed).

      The reason is, we only take into account the top-level "includePaths", and if it's empty, we interpret that as "don't include anything" in embedded entities...

      The issue can be worked around by specifying explicitly the paths to include on C.b.

      Note that this issue is here since 5.5.0.Final at least (I didn't check previous versions).

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                yrodiere Yoann Rodière
                Reporter:
                yrodiere Yoann Rodière
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: