Neo4j Community

org.neo4j.graphdb.index
Interface IndexManager


public interface IndexManager

A one stop shop for accessing Indexs for Nodes and Relationships. An IndexManager is paired with a GraphDatabaseService via GraphDatabaseService.index() so that indexes can be accessed directly from the graph database.


Field Summary
static String PROVIDER
          The configuration key to use for specifying which provider an index will have, i.e.
 
Method Summary
 boolean existsForNodes(String indexName)
          Returns whether or not there exists a node index with the name indexName.
 boolean existsForRelationships(String indexName)
          Returns whether or not there exists a relationship index with the name indexName.
 Index<Node> forNodes(String indexName)
          Returns an Index for Nodes with the name indexName.
 Index<Node> forNodes(String indexName, Map<String,String> customConfiguration)
          Returns an Index for Nodes with the name indexName.
 RelationshipIndex forRelationships(String indexName)
          Returns an Index for Relationships with the name indexName.
 RelationshipIndex forRelationships(String indexName, Map<String,String> customConfiguration)
          Returns an Index for Relationships with the name indexName.
 Map<String,String> getConfiguration(Index<? extends PropertyContainer> index)
          Returns the configuration for index.
 AutoIndexer<Node> getNodeAutoIndexer()
           
 RelationshipAutoIndexer getRelationshipAutoIndexer()
           
 String[] nodeIndexNames()
          Returns the names of all existing Node indexes.
 String[] relationshipIndexNames()
          Returns the names of all existing Relationship indexes.
 String removeConfiguration(Index<? extends PropertyContainer> index, String key)
          EXPERT: Removes a configuration parameter from an index.
 String setConfiguration(Index<? extends PropertyContainer> index, String key, String value)
          EXPERT: Sets a configuration parameter for an index.
 

Field Detail

PROVIDER

static final String PROVIDER
The configuration key to use for specifying which provider an index will have, i.e. which implementation will be used to back that index.

See Also:
Constant Field Values
Method Detail

existsForNodes

boolean existsForNodes(String indexName)
Returns whether or not there exists a node index with the name indexName. Indexes are created when needed in calls to forNodes(String) and forNodes(String, Map).

Parameters:
indexName - the name of the index to check.
Returns:
whether or not there exists a node index with the name indexName.

forNodes

Index<Node> forNodes(String indexName)
Returns an Index for Nodes with the name indexName. If such an index doesn't exist it will be created with default configuration. Indexes created with forNodes(String, Map) can be returned by this method also, so that you don't have to supply and match its configuration for consecutive accesses. This is the prefered way of accessing indexes, whether they were created with forNodes(String) or forNodes(String, Map).

Parameters:
indexName - the name of the node index.
Returns:
the Index corresponding to the indexName.

forNodes

Index<Node> forNodes(String indexName,
                     Map<String,String> customConfiguration)
Returns an Index for Nodes with the name indexName. If the index exists it will be returned if the provider and customConfiguration matches, else an IllegalArgumentException will be thrown. If the index doesn't exist it will be created with the given provider (given in the configuration map).

Parameters:
indexName - the name of the index to create.
customConfiguration - configuration for the index being created. Use the provider key to control which index implementation, i.e. the IndexImplementation to use for this index if it's created. The value represents the service name corresponding to the IndexImplementation. Other options can f.ex. say that the index will be a fulltext index and that it should be case insensitive. The parameters given here (except "provider") are only interpreted by the implementation represented by the provider.

nodeIndexNames

String[] nodeIndexNames()
Returns the names of all existing Node indexes. Those names can then be used to get to the actual Index instances.

Returns:
the names of all existing Node indexes.

existsForRelationships

boolean existsForRelationships(String indexName)
Returns whether or not there exists a relationship index with the name indexName. Indexes are created when needed in calls to forRelationships(String) and forRelationships(String, Map).

Parameters:
indexName - the name of the index to check.
Returns:
whether or not there exists a relationship index with the name indexName.

forRelationships

RelationshipIndex forRelationships(String indexName)
Returns an Index for Relationships with the name indexName. If such an index doesn't exist it will be created with default configuration. Indexes created with forRelationships(String, Map) can be returned by this method also, so that you don't have to supply and match its configuration for consecutive accesses. This is the prefered way of accessing indexes, whether they were created with forRelationships(String) or forRelationships(String, Map).

Parameters:
indexName - the name of the node index.
Returns:
the Index corresponding to the indexName.

forRelationships

RelationshipIndex forRelationships(String indexName,
                                   Map<String,String> customConfiguration)
Returns an Index for Relationships with the name indexName. If the index exists it will be returned if the provider and customConfiguration matches, else an IllegalArgumentException will be thrown. If the index doesn't exist it will be created with the given provider (given in the configuration map).

Parameters:
indexName - the name of the index to create.
customConfiguration - configuration for the index being created. Use the provider key to control which index implementation, i.e. the IndexImplementation to use for this index if it's created. The value represents the service name corresponding to the IndexImplementation. Other options can f.ex. say that the index will be a fulltext index and that it should be case insensitive. The parameters given here (except "provider") are only interpreted by the implementation represented by the provider.

relationshipIndexNames

String[] relationshipIndexNames()
Returns the names of all existing Relationship indexes. Those names can then be used to get to the actual Index instances.

Returns:
the names of all existing Relationship indexes.

getConfiguration

Map<String,String> getConfiguration(Index<? extends PropertyContainer> index)
Returns the configuration for index. Configuration can be set when creating an index, with f.ex forNodes(String, Map) or with setConfiguration(Index, String, String) or removeConfiguration(Index, String).

Returns:
configuration for the index.

setConfiguration

String setConfiguration(Index<? extends PropertyContainer> index,
                        String key,
                        String value)
EXPERT: Sets a configuration parameter for an index. If a configuration parameter with the given key it will be overwritten. WARNING: Overwriting parameters which controls the storage format of index data may lead to existing index data being unusable. The key "provider" is a reserved parameter and cannot be overwritten, if key is "provider" then an IllegalArgumentException will be thrown.

Parameters:
index - the index to set a configuration parameter for.
key - the configuration parameter key.
value - the new value of the configuration parameter.
Returns:
the overwritten value if any.

removeConfiguration

String removeConfiguration(Index<? extends PropertyContainer> index,
                           String key)
EXPERT: Removes a configuration parameter from an index. If there's no value for the given key nothing will happen and null will be returned. WARNING: Removing parameters which controls the storage format of index data may lead to existing index data being unusable. The key "provider" is a reserved parameter and cannot be removed, if key is "provider" then an IllegalArgumentException will be thrown.

Parameters:
index - the index to remove a configuration parameter from.
key - the configuration parameter key.
Returns:
the removed value if any.

getNodeAutoIndexer

AutoIndexer<Node> getNodeAutoIndexer()

getRelationshipAutoIndexer

RelationshipAutoIndexer getRelationshipAutoIndexer()

Neo4j Community

Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.