Bozho
Bozho

Reputation: 597234

Spring-data-neo4j isn't indexing the entity id

I have this @NodeEntity

@GraphId @Indexed
private Long id;
private String email;
private String password;
@Indexed
private String names;
private boolean registered;

However all fields are indexed (regardless of the annotations), except for the id property. I know that because I query the index with *:* and call .getPropertyKeys() on the returned IndexHits.

Is that a bug in SDN, or I should configure something different in order to make the ID be indexed as well. (On the other hand, using a QueryResultBuilder returns the entities with their IDs in place.

Upvotes: 2

Views: 349

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41706

@GraphId is provided by Neo4j (internal node-id), it is not indexable and you can use repository.findOne() or template.getNode(id) to look nodes up with that id.

I think you misunderstood: IndexHit<Node> returns the actual nodes and not the indexed fields.

How do you "query the index" ?

Upvotes: 2

Related Questions