use of org.neo4j.graphdb.schema.IndexSetting in project neo4j by neo4j.
the class SchemaAcceptanceTest method mustBeAbleToGetIndexConfig.
@Test
void mustBeAbleToGetIndexConfig() {
try (Transaction tx = db.beginTx()) {
IndexDefinition index = tx.schema().indexFor(label).on(propertyKey).withName("my_index").create();
Map<IndexSetting, Object> config = index.getIndexConfiguration();
assertNotNull(config);
assertTrue(config.containsKey(IndexSettingImpl.SPATIAL_CARTESIAN_MIN));
tx.commit();
}
try (Transaction tx = db.beginTx()) {
IndexDefinition index = getIndex(tx, "my_index");
Map<IndexSetting, Object> config = index.getIndexConfiguration();
assertNotNull(config);
assertTrue(config.containsKey(IndexSettingImpl.SPATIAL_CARTESIAN_MIN));
tx.commit();
}
}
use of org.neo4j.graphdb.schema.IndexSetting in project neo4j by neo4j.
the class SchemaAcceptanceTest method mustBeAbleToSpecifyIndexConfigurationForUniquenessConstraint.
@Test
void mustBeAbleToSpecifyIndexConfigurationForUniquenessConstraint() {
try (Transaction tx = db.beginTx()) {
ConstraintDefinition constraint = tx.schema().constraintFor(label).withName("my constraint").assertPropertyIsUnique(propertyKey).withIndexConfiguration(Map.of(IndexSettingImpl.SPATIAL_CARTESIAN_MAX, new double[] { 200.0, 200.0 }, IndexSettingImpl.SPATIAL_WGS84_MIN, new double[] { -90.0, -90.0 })).create();
IndexDefinition index = getIndex(tx, constraint.getName());
Map<IndexSetting, Object> config = index.getIndexConfiguration();
assertArrayEquals(new double[] { 200.0, 200.0 }, (double[]) config.get(IndexSettingImpl.SPATIAL_CARTESIAN_MAX));
assertArrayEquals(new double[] { -90.0, -90.0 }, (double[]) config.get(IndexSettingImpl.SPATIAL_WGS84_MIN));
tx.commit();
}
try (Transaction tx = db.beginTx()) {
IndexDefinition index = getIndex(tx, "my constraint");
Map<IndexSetting, Object> config = index.getIndexConfiguration();
assertArrayEquals(new double[] { 200.0, 200.0 }, (double[]) config.get(IndexSettingImpl.SPATIAL_CARTESIAN_MAX));
assertArrayEquals(new double[] { -90.0, -90.0 }, (double[]) config.get(IndexSettingImpl.SPATIAL_WGS84_MIN));
tx.commit();
}
}
Aggregations