Good news everyone,

A request that's often come up on the mailing list is a mechanism for
automatically indexing properties of nodes and relationships.

As of today's SNAPSHOT, auto-indexing is part of Neo4j which means nodes
and relationships can now be indexed based on convention, requiring
far less effort and code from the developer's point of view.

Getting hold of an automatic index is straightforward:

AutoIndexer<Node> nodeAutoIndexer = graphDb.index().getNodeAutoIndexer();
AutoIndex<Node> nodeAutoIndex = nodeAutoIndexer.getAutoIndex();

Once you've got an instance of AutoIndex, you can use it as a read-only
Index<Node>.

The AutoIndexer interface also supports runtime changes and
enabling/disabling the auto indexing functionality.

To support the new features, there are new Config
options you can pass to the startup configuration map in
EmbeddedGraphDatabase, the most important of which are:

Config.NODE_AUTO_INDEXING (defaults to "false")
Config.RELATIONSHIP_AUTO_INDEXING (defaults to "false")

If set to "true" (independently of each other) these properties will
enable auto indexing functionality and at the successful finish() of
each transaction, all newly added properties on the primitives for which
auto indexing is enabled will be added to a special AutoIndex (and
deleted or changed properties will be updated accordingly too).

There are options for fine grained control to determine
properties are indexed, default behaviors and so forth. For example, by
default all properties are indexed. If you want only properties "name" and
"age" for Nodes and "since" and "until" for Relationships
to be auto indexed, simply set the initial configuration as follows:

Config.NODE_KEYS_INDEXABLE = "name, age";
Config.RELATIONSHIP_KEYS_INDEXABLE="since, until";

For the semantics of the auto-indexing operations, constraints and more
detailed examples, see the documentation available  at

http://docs.neo4j.org/chunked/1.4-SNAPSHOT/auto-indexing.html

We're pretty excited about this feature since we think it'll make your lives
as developers much more productive in a range of use-cases. If you're
comfortable with using SNAPSHOT versions of Neo4j, please try it out
and let us know what you think - we'd really value your feedback.

If you're happier with using packaged milestones then this feature
will be available from 1.4 M05 in a couple of weeks from now.
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to