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 Details

    • on

      IndexCreator on(String propertyKey)
      Includes the given propertyKey in this index, such that nodes with the assigned label 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

      IndexCreator withName(String indexName)
      Assign a name to the index, which will then be returned from IndexDefinition.getName(), and can be used for finding the index with Schema.getIndexByName(String).
      Parameters:
      indexName - the name to give the index.
      Returns:
      an IndexCreator instance to be used for further interaction.
    • withIndexType

      IndexCreator withIndexType(IndexType type)
      Specify the type of index to be created.

      By default, the IndexType.RANGE will be used. See the documentation on IndexType 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

      IndexCreator withIndexConfiguration(Map<IndexSetting,Object> indexConfiguration)
      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.