Search in sources :

Example 1 with BatchInserterIndex

use of org.neo4j.unsafe.batchinsert.BatchInserterIndex in project neo4j by neo4j.

the class LegacyIndexTest method legacyIndexPopulationWithBunchOfFields.

@Test(timeout = TEST_TIMEOUT)
public void legacyIndexPopulationWithBunchOfFields() throws Exception {
    BatchInserter batchNode = BatchInserters.inserter(directory.graphDbDir());
    LuceneBatchInserterIndexProvider provider = new LuceneBatchInserterIndexProvider(batchNode);
    try {
        BatchInserterIndex batchIndex = provider.nodeIndex("node_auto_index", stringMap(IndexManager.PROVIDER, "lucene", "type", "fulltext"));
        Map<String, Object> properties = new HashMap<>();
        for (int i = 0; i < 2000; i++) {
            properties.put(Integer.toString(i), RandomStringUtils.randomAlphabetic(200));
        }
        long node = batchNode.createNode(properties, Label.label("NODE"));
        batchIndex.add(node, properties);
    } finally {
        provider.shutdown();
        batchNode.shutdown();
    }
}
Also used : BatchInserter(org.neo4j.unsafe.batchinsert.BatchInserter) LuceneBatchInserterIndexProvider(org.neo4j.index.lucene.unsafe.batchinsert.LuceneBatchInserterIndexProvider) HashMap(java.util.HashMap) BatchInserterIndex(org.neo4j.unsafe.batchinsert.BatchInserterIndex) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 Test (org.junit.Test)1 LuceneBatchInserterIndexProvider (org.neo4j.index.lucene.unsafe.batchinsert.LuceneBatchInserterIndexProvider)1 BatchInserter (org.neo4j.unsafe.batchinsert.BatchInserter)1 BatchInserterIndex (org.neo4j.unsafe.batchinsert.BatchInserterIndex)1