use of org.neo4j.configuration.GraphDatabaseSettings.SchemaIndex in project neo4j by neo4j.
the class MemoryRecommendationsCommandTest method createDatabaseWithNativeIndexes.
private static void createDatabaseWithNativeIndexes(Path homeDirectory, String databaseName) {
// Create one index for every provider that we have
for (SchemaIndex schemaIndex : SchemaIndex.values()) {
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(homeDirectory).setConfig(default_schema_provider, schemaIndex.providerName()).setConfig(default_database, databaseName).build();
GraphDatabaseService db = managementService.database(databaseName);
String key = "key-" + schemaIndex.name();
try {
Label labelOne = Label.label("one");
try (Transaction tx = db.beginTx()) {
tx.schema().indexFor(labelOne).on(key).create();
tx.commit();
}
try (Transaction tx = db.beginTx()) {
RandomValues randomValues = RandomValues.create();
for (int i = 0; i < 10_000; i++) {
tx.createNode(labelOne).setProperty(key, randomValues.nextValue().asObject());
}
tx.commit();
}
} finally {
managementService.shutdown();
}
}
}
Aggregations