Can Hibernate Search be configured for NodeEntiny?

152 Views Asked by At

I am trying to build hibernate full text search for a nodeEntity. It gives:

Can't build query for type x.y.z.Object which is neither configured nor has any configured sub-types

My class is like below. I am using Neo4j database.

@NodeEntity
@Getter
@Setter
public class ClassName {

    @Index
    private String xyzId;

    @Index
    @Field(index = org.hibernate.search.annotations.Index.YES, analyze = Analyze.NO, store = Store.YES)
    private String xyz;
}
1

There are 1 best solutions below

1
On

To make any Hibernate entity managed by Hibernate Search you have to mark it with org.hibernate.search.annotations.Indexed.

So you're missing two things:

  1. it must be an entity managed by Hibernate ORM (or OGM)
  2. it's missing the @Indexed annotation on ClassName.

Your example looks like it's using a Neo4J native mapping; that won't work. You might want to look into Hibernate OGM, which makes it possible to store actual Hibernate entities into NoSQL databases, including Neo4J.