@IndexEmbedded : problem with overlap

Hello everyone,

Suppose I have two @Entity to index. So I annotated each one with @Indexed. Here the code :

@Entity
@Indexed
public class MentionMicen {
     private Acte acte;

       @IndexedEmbedded(includePaths = {
			Acte_.ID,
			Acte_.DOSSIER + "." + Dossier_.ID,
			Acte_.TYPE_ACTE + "." + TypeActe_.LIBELLE,
			Acte_.LIBELLE,
			Acte_.DOSSIER + "." + Dossier_.LIBELLE,
			Acte_.DOSSIER + "." + Dossier_.NUMERO,
			Acte_.DOSSIER + "." + Dossier_.TYPE + "." + TypeDossier_.GENRE
	})
    public Acte getActe() {
        return acte;
    }
  }

and I have the other entity :

@Entity
@Indexed
public class ActePrive extends Acte {
   
}
public class Acte {
 private Dossier dossier;

    @IndexedEmbedded(includePaths = {
			Dossier_.ID,
			Dossier_.NUMERO,
			Dossier_.CLERC + "." + Clerc_.ID,
			Dossier_.SECRETAIRE + "." + Secretaire_.ID,
			Dossier_.NOTAIRE + "." + Notaire_.ID
	})
	public Dossier getDossier() {
		return this.dossier;
	}
}

The mass indexer will fail with the code above. Because the path specified on MentionMicen.getActe() :

Acte_.DOSSIER + "." + Dossier_.LIBELLE,
Acte_.DOSSIER + "." + Dossier_.TYPE + "." + TypeDossier_.GENRE

is not existing. To correct the problem I simply add this path to Acte.getDossier() :

public class Acte {
 private Dossier dossier;

@IndexedEmbedded(includePaths = {
			Dossier_.ID,
			Dossier_.NUMERO,
			Dossier_.LIBELLE,
			Dossier_.TYPE + "." + TypeDossier_.GENRE,
			Dossier_.CLERC + "." + Clerc_.ID,
			Dossier_.SECRETAIRE + "." + Secretaire_.ID,
			Dossier_.NOTAIRE + "." + Notaire_.ID
	})
	public Dossier getDossier() {
		return this.dossier;
	}
}

The problem is that now, the indexed entity ActePrive includes data index in each document I don’t care ; the two one I have to add so to correct the mass indexer problem.
How can I prevent to index extra data in ActePrive documents which I don’t care ?

I attempt to annotate my indexed entities as close as possible to real Json created indexes (through
@IndexEmbedded)

Thx.

Hello,

At the moment, when you nest two @IndexedEmbedded, the surrounding one cannot embed more than was embedded in the nested one. In short, you cannot embed what doesn’t exist.

If you are interested in changing that, be sure to vote for https://hibernate.atlassian.net/browse/HSEARCH-1112. We’ll get to it eventually, but there are other things to do, so we need input in order to prioritize.

Ok thanks.

Unfortunately, I can’t override the method in ActePrive because @IndexEmbedded can’t be override but inherited, hence it even define two @IndexEmbedded name for HSearch => not a solution.
Maybe, the root object (@Indexed) should define all paths strictly, regardless of what the embedded index says. Furthermoe, like this, we can suppose that @IndexingDependencies is almost a copy/paste, yes or no ?
For me, although we can index differently, all the json paths should be clearly readeable in the root indexed entity.

I don’t know what you are talking about; your initial post doesn’t mention an override. That doesn’t seem relevant to the conversation.

It certainly seems to be what you need. As I mentioned above:

The code in your initial post does not use @IndexingDependency. I don’t know what you are talking about. I don’t have your full business model in mind, I can only help if you give all the relevant information.