@IndexingDependency cannot detect properties of embedded custom class

Hi!

Tried to add two paths into derivedFrom, but I get an error:

org.hibernate.search.util.common.SearchException: HSEARCH700078:
No readable property named ‘parent.name’ on type ‘com.thevegcat.app.entities.provider.Provider’.

What is the syntax to put a reference to name property of parent property?
I see there is additional extraction property of @PropertyValue on top of propertyName, but I can’t find how to use it.

@Entity @Indexed class Provider {	@FullTextField	private LocalizedField name;	@ManyToOne( fetch = FetchType.LAZY )	private Priovider parent;	@Transient	@IndexingDependency( derivedFrom = {	@ObjectPath(@PropertyValue(propertyName = "name")),	@ObjectPath(@PropertyValue(propertyName = "parent.name"))	} )	@KeywordField(name = "sortableTitle", projectable = Projectable.NO,	searchable = Searchable.NO, sortable = Sortable.YES)	public String getSortableTitle() {	String name = this.name.get(LocaleUtil.SORT_LOCALE);	if (this.parent == null) { return name; }	return this.parent.name.get(LocaleUtil.SORT_LOCALE) + '.' + name;	} } 

The right syntax is:

@IndexingDependency(derivedFrom = {	@ObjectPath(@PropertyValue(propertyName = "name")),	@ObjectPath({	@PropertyValue(propertyName = "parent"),	@PropertyValue(propertyName = "name")	})	}) 

Found it here:
spring - Index HashMap using keys as fields names. HibernateSearch - Stack Overflow

@yrodiere Maybe to put similar example into Reference Documentation because it’s not so intuitive to guess?

I doubt that will cut it. What we need is a better syntax: [HSEARCH-4392] - Hibernate JIRA

1 Like