Search in sources :

Example 6 with IndexProviderDescriptor

use of org.neo4j.internal.schema.IndexProviderDescriptor in project neo4j by neo4j.

the class FusionIndexProviderTest method mockProvider.

private static IndexProvider mockProvider(Class<? extends IndexProvider> providerClass, String name) {
    IndexProvider mock = mock(providerClass);
    when(mock.getProviderDescriptor()).thenReturn(new IndexProviderDescriptor(name, "1"));
    return mock;
}
Also used : GenericNativeIndexProvider(org.neo4j.kernel.impl.index.schema.GenericNativeIndexProvider) IndexProvider(org.neo4j.kernel.api.index.IndexProvider) IndexProviderDescriptor(org.neo4j.internal.schema.IndexProviderDescriptor)

Example 7 with IndexProviderDescriptor

use of org.neo4j.internal.schema.IndexProviderDescriptor in project neo4j by neo4j.

the class MultiIndexPopulationConcurrentUpdatesIT method createIndexRules.

private IndexDescriptor[] createIndexRules(GraphDatabaseSettings.SchemaIndex schemaIndex, Map<String, Integer> labelNameIdMap, int propertyId) {
    final IndexProviderMap indexProviderMap = getIndexProviderMap();
    IndexProvider indexProvider = indexProviderMap.lookup(schemaIndex.providerName());
    IndexProviderDescriptor providerDescriptor = indexProvider.getProviderDescriptor();
    List<IndexDescriptor> list = new ArrayList<>();
    for (Integer labelId : labelNameIdMap.values()) {
        final LabelSchemaDescriptor schema = SchemaDescriptor.forLabel(labelId, propertyId);
        IndexDescriptor index = IndexPrototype.forSchema(schema, providerDescriptor).withName("index_" + labelId).materialise(labelId);
        index = indexProvider.completeConfiguration(index);
        list.add(index);
    }
    return list.toArray(new IndexDescriptor[0]);
}
Also used : IndexProvider(org.neo4j.kernel.api.index.IndexProvider) IndexProviderDescriptor(org.neo4j.internal.schema.IndexProviderDescriptor) ArrayList(java.util.ArrayList) LabelSchemaDescriptor(org.neo4j.internal.schema.LabelSchemaDescriptor) IndexDescriptor(org.neo4j.internal.schema.IndexDescriptor) IndexProviderMap(org.neo4j.kernel.impl.api.index.IndexProviderMap)

Example 8 with IndexProviderDescriptor

use of org.neo4j.internal.schema.IndexProviderDescriptor in project neo4j by neo4j.

the class BuiltInProcedures method createUniquePropertyConstraint.

@Deprecated(since = "4.2.0", forRemoval = true)
@Description("Create a named unique property constraint. Backing index will use specified index provider and configuration (optional). " + "Yield: name, labels, properties, providerName, status")
@Procedure(name = "db.createUniquePropertyConstraint", mode = SCHEMA, deprecatedBy = "CREATE CONSTRAINT ... IS UNIQUE command")
public Stream<SchemaIndexInfo> createUniquePropertyConstraint(@Name("constraintName") String constraintName, @Name("labels") List<String> labels, @Name("properties") List<String> properties, @Name("providerName") String providerName, @Name(value = "config", defaultValue = "{}") Map<String, Object> config) throws ProcedureException {
    IndexProcedures indexProcedures = indexProcedures();
    final IndexProviderDescriptor indexProviderDescriptor = getIndexProviderDescriptor(providerName);
    return indexProcedures.createUniquePropertyConstraint(constraintName, labels, properties, indexProviderDescriptor, config);
}
Also used : IndexProviderDescriptor(org.neo4j.internal.schema.IndexProviderDescriptor) Description(org.neo4j.procedure.Description) SystemProcedure(org.neo4j.kernel.api.procedure.SystemProcedure) Procedure(org.neo4j.procedure.Procedure)

Example 9 with IndexProviderDescriptor

use of org.neo4j.internal.schema.IndexProviderDescriptor in project neo4j by neo4j.

the class SchemaLoggingIT method shouldLogUserReadableLabelAndPropertyNames.

@Test
void shouldLogUserReadableLabelAndPropertyNames() {
    String labelName = "User";
    String property = "name";
    // when
    long indexId = createIndex(db, labelName, property);
    // then
    IndexProvider defaultProvider = indexProviderMap.getDefaultProvider();
    IndexProviderDescriptor providerDescriptor = defaultProvider.getProviderDescriptor();
    String indexName = "Index( id=" + indexId + ", name='index_a908f819', type='GENERAL BTREE', " + "schema=(:User {name}), indexProvider='" + providerDescriptor.name() + "' )";
    assertThat(logProvider).forLevel(INFO).containsMessageWithArguments("Index population started: [%s]", indexName).containsMessageWithArguments(CREATION_FINISHED, indexName);
}
Also used : IndexProvider(org.neo4j.kernel.api.index.IndexProvider) IndexProviderDescriptor(org.neo4j.internal.schema.IndexProviderDescriptor) Test(org.junit.jupiter.api.Test)

Example 10 with IndexProviderDescriptor

use of org.neo4j.internal.schema.IndexProviderDescriptor in project neo4j by neo4j.

the class AccessUniqueDatabaseIndexTest method getIndexStorage.

private PartitionedIndexStorage getIndexStorage() {
    IndexProviderDescriptor descriptor = new IndexProviderDescriptor(NATIVE30.providerKey(), NATIVE30.providerVersion());
    IndexDirectoryStructure parent = directoriesByProvider(databaseLayout.databaseDirectory()).forProvider(descriptor);
    IndexStorageFactory storageFactory = new IndexStorageFactory(directoryFactory, fileSystem, directoriesBySubProvider(parent).forProvider(LuceneIndexProvider.DESCRIPTOR));
    return storageFactory.indexStorageOf(1);
}
Also used : IndexStorageFactory(org.neo4j.kernel.api.impl.index.storage.IndexStorageFactory) IndexDirectoryStructure(org.neo4j.kernel.api.index.IndexDirectoryStructure) IndexProviderDescriptor(org.neo4j.internal.schema.IndexProviderDescriptor)

Aggregations

IndexProviderDescriptor (org.neo4j.internal.schema.IndexProviderDescriptor)41 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)18 Test (org.junit.jupiter.api.Test)16 IndexProvider (org.neo4j.kernel.api.index.IndexProvider)11 IndexPrototype (org.neo4j.internal.schema.IndexPrototype)10 ArrayList (java.util.ArrayList)5 FulltextSchemaDescriptor (org.neo4j.internal.schema.FulltextSchemaDescriptor)5 IndexDirectoryStructure (org.neo4j.kernel.api.index.IndexDirectoryStructure)5 IndexConfig (org.neo4j.internal.schema.IndexConfig)4 LabelSchemaDescriptor (org.neo4j.internal.schema.LabelSchemaDescriptor)4 Path (java.nio.file.Path)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 IndexPopulator (org.neo4j.kernel.api.index.IndexPopulator)3 IOException (java.io.IOException)2 UncheckedIOException (java.io.UncheckedIOException)2 String.format (java.lang.String.format)2 Arrays (java.util.Arrays)2 Collection (java.util.Collection)2 EnumMap (java.util.EnumMap)2 HashMap (java.util.HashMap)2