Hello everyone,
I would like indexing all my entities and search results in all of them in one request.
To resolve that, I made all my entities ihnerited from an abstract class. But when I create my query, I have the error
HSEARCH000109: [...].domain.AbstractDomainEntity is not an indexed type.
In my indexes directory I have the following folder : "lucene\indexes\[...].domain.AbstractDomainEntity"
Here is my abstract class :
Code:
@Indexed
@SuppressWarnings("serial")
@MappedSuperclass
public abstract class AbstractDomainEntity implements Serializable {
@Id
@GeneratedValue
private Long id;
//...
}
And here the way I create the query :
Code:
QueryBuilder queryBuilder = fullTextEntityManager.getSearchFactory()
.buildQueryBuilder().forEntity( AbstractDomainEntity.class ).get();
org.apache.lucene.search.Query luceneQuery = queryBuilder
.keyword()
.fuzzy()
.withThreshold(rechercheFuzzyThreshold)
.withPrefixLength(rechercheFuzzyPrefixLength)
.onField(rechercheChamp)
.matching(critere)
.createQuery();
// wrap Lucene query in a javax.persistence.Query
javax.persistence.Query persistenceQuery =
fullTextEntityManager.createFullTextQuery(luceneQuery, AbstractDomainEntity.class);
// execute search
List<Object> result = persistenceQuery.getResultList();
What's wrong ??