Hello folks,
I have a node like this:
@NodeEntity
public class ExampleNode {
@GraphId
Long id;
@Index
String symbol;
//two additional attributes with the Index annotation and a few more without
}
I use the embedded driver to create the nodes but when I run the CALL db.indexes it returns nothing... Am I doing something wrong?
Apparently the Index annotation is not enough, indexing is disabled by default. You need to change your configuration to enable indexing:
@Value("${spring.data.neo4j.uri}")
private String embeddedDataDir;
@Primary
@Bean
public SessionFactory sessionFactory() {
org.neo4j.ogm.config.Configuration config = new org.neo4j.ogm.config.Configuration();
config
.driverConfiguration()
.setDriverClassName("org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver")
.setURI(embeddedDataDir);
config.autoIndexConfiguration().setAutoIndex("assert");
return new SessionFactory(config, "com.example");
}