Search in sources :

Example 6 with IndexConfig

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

the class SchemaStatementProcedure method fulltextConfigAsString.

private static String fulltextConfigAsString(IndexDescriptor indexDescriptor) {
    final IndexConfig indexConfig = indexDescriptor.getIndexConfig();
    StringJoiner configString = configStringJoiner();
    for (Pair<String, Value> entry : indexConfig.entries()) {
        String key = entry.getOne();
        String singleConfig = format(SINGLE_CONFIG, key, fulltextConfigValueAsString(entry.getTwo()));
        configString.add(singleConfig);
    }
    return configString.toString();
}
Also used : IndexConfig(org.neo4j.internal.schema.IndexConfig) Value(org.neo4j.values.storable.Value) StringValue(org.neo4j.values.storable.StringValue) BooleanValue(org.neo4j.values.storable.BooleanValue) IntValue(org.neo4j.values.storable.IntValue) StringJoiner(java.util.StringJoiner)

Example 7 with IndexConfig

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

the class SchemaStatementProcedure method btreeConfigAsString.

private static String btreeConfigAsString(IndexDescriptor indexDescriptor) {
    final IndexConfig indexConfig = indexDescriptor.getIndexConfig();
    StringJoiner configString = configStringJoiner();
    for (Pair<String, Value> entry : indexConfig.entries()) {
        String singleConfig = format(SINGLE_CONFIG, entry.getOne(), btreeConfigValueAsString(entry.getTwo()));
        configString.add(singleConfig);
    }
    return configString.toString();
}
Also used : IndexConfig(org.neo4j.internal.schema.IndexConfig) Value(org.neo4j.values.storable.Value) StringValue(org.neo4j.values.storable.StringValue) BooleanValue(org.neo4j.values.storable.BooleanValue) IntValue(org.neo4j.values.storable.IntValue) StringJoiner(java.util.StringJoiner)

Example 8 with IndexConfig

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

the class IndexProcedures method createIndex.

private Stream<BuiltInProcedures.SchemaIndexInfo> createIndex(String name, List<String> labels, List<String> properties, IndexProviderDescriptor indexProviderDescriptor, Map<String, Object> configMap, String statusMessage, IndexCreator indexCreator) throws ProcedureException {
    IndexConfig indexConfig = IndexSettingUtil.toIndexConfigFromStringObjectMap(configMap);
    assertSingleLabel(labels);
    assertValidIndexProvider(indexProviderDescriptor);
    int labelId = getOrCreateLabelId(labels.get(0));
    int[] propertyKeyIds = getOrCreatePropertyIds(properties);
    try {
        SchemaWrite schemaWrite = ktx.schemaWrite();
        LabelSchemaDescriptor labelSchemaDescriptor = SchemaDescriptor.forLabel(labelId, propertyKeyIds);
        indexCreator.create(schemaWrite, name, labelSchemaDescriptor, indexProviderDescriptor, indexConfig);
        return Stream.of(new BuiltInProcedures.SchemaIndexInfo(name, labels, properties, indexProviderDescriptor.name(), statusMessage));
    } catch (KernelException e) {
        throw new ProcedureException(e.status(), e, e.getMessage());
    }
}
Also used : IndexConfig(org.neo4j.internal.schema.IndexConfig) SchemaWrite(org.neo4j.internal.kernel.api.SchemaWrite) LabelSchemaDescriptor(org.neo4j.internal.schema.LabelSchemaDescriptor) ProcedureException(org.neo4j.internal.kernel.api.exceptions.ProcedureException) IndexNotFoundKernelException(org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException) KernelException(org.neo4j.exceptions.KernelException)

Example 9 with IndexConfig

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

the class FulltextIndexProvider method completeConfiguration.

@Override
public IndexDescriptor completeConfiguration(IndexDescriptor index) {
    IndexConfig indexConfig = index.getIndexConfig();
    indexConfig = addMissingDefaultIndexConfig(indexConfig);
    index = index.withIndexConfig(indexConfig);
    if (index.getCapability().equals(IndexCapability.NO_CAPABILITY)) {
        index = index.withIndexCapability(getCapability(index));
    }
    return index;
}
Also used : IndexConfig(org.neo4j.internal.schema.IndexConfig)

Example 10 with IndexConfig

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

the class GenericNativeIndexProvider method layout.

@Override
GenericLayout layout(IndexDescriptor descriptor, Path storeFile) {
    int numberOfSlots = descriptor.schema().getPropertyIds().length;
    IndexConfig indexConfig = descriptor.getIndexConfig();
    Map<CoordinateReferenceSystem, SpaceFillingCurveSettings> settings = SpatialIndexConfig.extractSpatialConfig(indexConfig);
    return new GenericLayout(numberOfSlots, new IndexSpecificSpaceFillingCurveSettings(settings));
}
Also used : IndexSpecificSpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettings) IndexConfig(org.neo4j.internal.schema.IndexConfig) IndexSpecificSpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettings) SpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings) CoordinateReferenceSystem(org.neo4j.values.storable.CoordinateReferenceSystem)

Aggregations

IndexConfig (org.neo4j.internal.schema.IndexConfig)21 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)10 Test (org.junit.jupiter.api.Test)9 Value (org.neo4j.values.storable.Value)6 IndexProviderDescriptor (org.neo4j.internal.schema.IndexProviderDescriptor)5 LabelSchemaDescriptor (org.neo4j.internal.schema.LabelSchemaDescriptor)4 SchemaDescriptor (org.neo4j.internal.schema.SchemaDescriptor)4 CoordinateReferenceSystem (org.neo4j.values.storable.CoordinateReferenceSystem)4 HashMap (java.util.HashMap)3 IndexPrototype (org.neo4j.internal.schema.IndexPrototype)3 Path (java.nio.file.Path)2 StringJoiner (java.util.StringJoiner)2 Config (org.neo4j.configuration.Config)2 FulltextSchemaDescriptor (org.neo4j.internal.schema.FulltextSchemaDescriptor)2 KernelTransactionImplementation (org.neo4j.kernel.impl.api.KernelTransactionImplementation)2 SpaceFillingCurveSettings (org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings)2 BooleanValue (org.neo4j.values.storable.BooleanValue)2 DoubleArray (org.neo4j.values.storable.DoubleArray)2 IntValue (org.neo4j.values.storable.IntValue)2 StringValue (org.neo4j.values.storable.StringValue)2