Database Reference
In-Depth Information
node_auto_indexing=true
relationship_auto_indexing=true
Specifying what you want to index requires the addition of the following two
neo4j.properties:
node_keys_indexable=name, dateOfBirth
relationship_keys_indexable=type,name
Configuring auto-indexing in embedded mode
To turn on auto-indexing for Neo4j in embedded mode, you'll need to pass in additional
values when you create the graph database instance. The following values need to be in-
cluded as part of the java.util.Map argument containing configuration:
Map<String, String> config = new HashMap<String, String>();
config.put( Config.NODE_AUTO_INDEXING, "true" );
config.put( Config.RELATIONSHIP_AUTO_INDEXING, "true" );
EmbeddedGraphDatabase graphDb =
new EmbeddedGraphDatabase("/var/neo4j/data", config );
Usingtheconfigmapprogrammaticallyrequirestheadditionoftwoproperties,whichcon-
tain a list of key names to index:
config.put( Config.NODE_KEYS_INDEXABLE, "name, dateOfBirth" );
config.put( Config.RELATIONSHIP_KEYS_INDEXABLE, "type, name" );
Using an automatically created index
Once you've added the appropriate configuration properties, the graph should be search-
able through the auto-index. For example, given the preceding configuration, all relation-
ships in the graph that have properties type or name , and all nodes in the graph that have
properties name and dateOfBirth , should be searchable via the auto-index.
You've probably noticed that there's no way to specify an index name in the configuration,
so you can't specify that you want to index node names in one index and date of birth in
another. This is somewhat different from manual indexing, where an index name is always
specified. This is because Neo4j has exactly one index for auto-indexed relationships and
one index for auto-indexed nodes.
Search WWH ::




Custom Search