Package org.neo4j.graphdb.schema
Interface IndexCreator
public interface IndexCreator
A builder for entering details about an index to create. After all details have been entered
create()
must be called for the index to actually be created. An index creator knows
which label
it is to be created for.
All methods except create()
will return an IndexCreator
which should be
used for further interaction.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncreate()
Creates an index with the details specified by the other methods in this interface.withIndexConfiguration
(Map<IndexSetting, Object> indexConfiguration) Set index-specific index configurations.withIndexType
(IndexType type) Specify the type of index to be created.Assign a name to the index, which will then be returned fromIndexDefinition.getName()
, and can be used for finding the index withSchema.getIndexByName(String)
.
-
Method Details
-
on
Includes the givenpropertyKey
in this index, such thatnodes
with the assignedlabel
and this property key will have its values indexed.NOTE: currently only a single property key per index is supported.
- Parameters:
propertyKey
- the property key to include in this index to be created.- Returns:
- an
IndexCreator
instance to be used for further interaction.
-
withName
Assign a name to the index, which will then be returned fromIndexDefinition.getName()
, and can be used for finding the index withSchema.getIndexByName(String)
.- Parameters:
indexName
- the name to give the index.- Returns:
- an
IndexCreator
instance to be used for further interaction.
-
withIndexType
Specify the type of index to be created.By default, the
IndexType.RANGE
will be used. See the documentation onIndexType
for more information about the different index types.- Parameters:
type
- the desired index type.- Returns:
- an
IndexCreator
instance to be used for further interaction.
-
withIndexConfiguration
Set index-specific index configurations.This call will override the settings from any previous call to this method.
- Parameters:
indexConfiguration
- The index settings in the index configuration that differ from their defaults.- Returns:
- an
IndexCreator
instance to be used for further interaction.
-
create
Creates an index with the details specified by the other methods in this interface.- Returns:
- the created
index
. - Throws:
ConstraintViolationException
- if creating this index would violate one or more constraints.
-