Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neo4j.index
Interface IndexService

All Known Implementing Classes:
  org.neo4j.index.impl.GenericIndexService, LuceneFulltextIndexService, LuceneFulltextQueryIndexService, LuceneIndexService, LuceneReadOnlyIndexService, RemoteIndexService

    public interface IndexService

Index service to index nodes with a key and a value. The Neo4j Kernel has no indexing features built-in. Instead you'll have to manage indexing manually. IndexService is a means of providing those indexing capabilities for a Neo4j graph and integrate it as tightly as possible with the graph engine.

Note that changes on `Node` properties respective nodes that are deleted must be propagated to the index by the application.

See more at The Neo4j wiki page on "Indexing with IndexService".

Method Summary
`IndexHits<Node>` | `getNodes(String key, Object value)` Returns all nodes indexed with `key` and `value`.
`Node` | `getSingleNode(String key, Object value)` Returns a single node indexed with associated with `key` and `value`.
`void` | `index(Node node, String key, Object value)` Index `node` with `key` and `value`.
`void` | `removeIndex(Node node, String key)` Dissociates a node from all indexed values for the given `key`.
`void` | `removeIndex(Node node, String key, Object value)` Dissociates a key-value pair from `node`.
`void` | `removeIndex(String key)` Dissociates all key-value pairs which `key` is part of, i.e.
`void` | `shutdown()` Shuts down the index service.

Method Detail

### index

    void index(Node node,
               String key,
               Object value)

  Index `node` with `key` and `value`. A node can be associated with any number of key-value pairs.

  Note about updating an index: If you've indexed a value from a property on a `Node` and that value gets updated, you'll have to remove the old value in addition to indexing the new value, else both values (the new and the old) will be indexed for that node.

  When deleting a `Node`, application should remove the index entries for the node as well, to keep the index consistent with the node space.

  Parameters:
    `node` - node to index
    `key` - the key in the key-value pair to associate with `node`.
    `value` - the value in the key-value pair to associate with `node`.

### getSingleNode

    Node getSingleNode(String key,
                       Object value)

  Returns a single node indexed with associated with `key` and `value`. If no such node exist `null` is returned. If more then one node is found a runtime exception is thrown.

  Parameters:
    `key` - the key for index
    `value` - the value for index
  Returns:
    node that has been indexed with key and value or `null`

### getNodes

    IndexHits<Node> getNodes(String key,
                             Object value)

  Returns all nodes indexed with `key` and `value`.

  Parameters:
    `key` - the key for index
    `value` - the value for index
  Returns:
    nodes that have been indexed with key and value

### removeIndex

    void removeIndex(Node node,
                     String key,
                     Object value)

  Dissociates a key-value pair from `node`. If no such association exist this method silently returns.

  Parameters:
    `node` - the node to dissociate from the key-value pair.
    `key` - the key in the key-value pair.
    `value` - the value in the key-value pair.

### removeIndex

    void removeIndex(Node node,
                     String key)

  Dissociates a node from all indexed values for the given `key`. If no such association exists this method silently returns. Implementations may choose to not implement this method and should in such a case throw `UnsupportedOperationException`.

  Parameters:
    `node` - the node to dissociate from all indexed values for the given `key`.
    `key` - the key in the key-value pairs to remove.

### removeIndex

    void removeIndex(String key)

  Dissociates all key-value pairs which `key` is part of, i.e. clearing the an entire index `key` is cleared. Implementations may choose to not implement this method and should in such a case throw `UnsupportedOperationException`.

  Parameters:
    `key` - the index to clear.

### shutdown

    void shutdown()

  Shuts down the index service. After this method has been invoked any following method invocation on this instance is invalid.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010 Neo4j. All Rights Reserved.