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.lucene
Class LuceneIndexBatchInserterImpl

    java.lang.Object
      org.neo4j.index.lucene.LuceneIndexBatchInserterImpl

All Implemented Interfaces:
  LuceneIndexBatchInserter

Direct Known Subclasses:
  LuceneFulltextIndexBatchInserter

    public class LuceneIndexBatchInserterImpl

extends Object
implements LuceneIndexBatchInserter

The implementation of `LuceneIndexBatchInserter`.

Constructor Summary
`LuceneIndexBatchInserterImpl(org.neo4j.kernel.impl.batchinsert.BatchInserter inserter)`

Method Summary
`protected void` | `fillDocument(org.apache.lucene.document.Document document, long nodeId, String key, Object value)`
`protected org.apache.lucene.search.Query` | `formQuery(String key, Object value)`
`org.neo4j.kernel.impl.batchinsert.BatchInserter` | `getBatchInserter()`
`protected String` | `getDirName()`
`IndexService` | `getIndexService()`
`protected org.apache.lucene.document.Field.Index` | `getIndexStrategy()`
`IndexHits<Long>` | `getNodes(String key, Object value)` Queries the lucene index for hits given the `key` and `value` .
`long` | `getSingleNode(String key, Object value)`
`void` | `index(long node, String key, Object value)` Adds an entry to the index.
`void` | `optimize()` Performs a Lucene optimize on the index files.
`void` | `shutdown()` Shuts down this index and closes its underlying lucene index files.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LuceneIndexBatchInserterImpl

    public LuceneIndexBatchInserterImpl(org.neo4j.kernel.impl.batchinsert.BatchInserter inserter)

Parameters:
  `inserter` - the `BatchInserter` to use.

Method Detail

### getDirName

    protected String getDirName()

### index

    public void index(long node,
                      String key,
                      Object value)

  Description copied from interface: `LuceneIndexBatchInserter`
  Adds an entry to the index.

  Specified by:
    `index` in interface `LuceneIndexBatchInserter`
  Parameters:
    `node` - the node to associate with the `value` in the index with name `key`.
    `key` - which index to put it in.
    `value` - the value to associate `node` with.

### fillDocument

    protected void fillDocument(org.apache.lucene.document.Document document,
                                long nodeId,
                                String key,
                                Object value)

### getIndexStrategy

    protected org.apache.lucene.document.Field.Index getIndexStrategy()

### shutdown

    public void shutdown()

  Description copied from interface: `LuceneIndexBatchInserter`
  Shuts down this index and closes its underlying lucene index files. If this isn't called before the JVM dies then there's no guarantee that the indices are stored correctly on disk.

  Specified by:
    `shutdown` in interface `LuceneIndexBatchInserter`

### getNodes

    public IndexHits<Long> getNodes(String key,
                                    Object value)

  Description copied from interface: `LuceneIndexBatchInserter`
  Queries the lucene index for hits given the `key` and `value` . The usage of `LuceneIndexBatchInserter.getNodes(String, Object)`, `LuceneIndexBatchInserter.getSingleNode(String, Object)` should be as separated as possible from the usage of `LuceneIndexBatchInserter.index(long, String, Object)`. so that the performance penalty gets as small as possible. Also see `LuceneIndexBatchInserter.optimize()` for separation between writes and reads.

  Specified by:
    `getNodes` in interface `LuceneIndexBatchInserter`
  Parameters:
    `key` - the index.
    `value` - the value to query for.
  Returns:
    the hits for the query.

### formQuery

    protected org.apache.lucene.search.Query formQuery(String key,
                                                       Object value)

### optimize

    public void optimize()

  Description copied from interface: `LuceneIndexBatchInserter`
  Performs a Lucene optimize on the index files. Do not use this too often as it comes with a severe performance penalty. It optimizes the Lucene index files so that consecutive queries will be faster. So the optimal usage is to index all of your data that you would like to index (with minimal amount of reads during that time). When you're done indexing and move into a phase where you'd want to use the index for lookups (maybe for creating relationships between nodes) you can call this method so that your queries will be faster than they would otherwise be.

  Specified by:
    `optimize` in interface `LuceneIndexBatchInserter`
  See Also:
    `IndexWriter.optimize()`

### getSingleNode

    public long getSingleNode(String key,
                              Object value)

  Specified by:
    `getSingleNode` in interface `LuceneIndexBatchInserter`
  Parameters:
    `key` - the index key to query.
    `value` - the value to query for.
  Returns:
    the node id or -1 if no node found. It will throw a RuntimeException if there's more than one node in the result.

### getIndexService

    public IndexService getIndexService()

  Specified by:
    `getIndexService` in interface `LuceneIndexBatchInserter`
  Returns:
    this batch inserter index wrapped in a `IndexService` interface for convenience. Goes well with an instance from `BatchInserter.getGraphDbService()`.

### getBatchInserter

    public org.neo4j.kernel.impl.batchinsert.BatchInserter getBatchInserter()

  Specified by:
    `getBatchInserter` in interface `LuceneIndexBatchInserter`
  Returns:
    the `BatchInserter` used in conjunction with this index batch inserter.

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.