private static void initializeIndex() { indexProvider = new LuceneBatchInserterIndexProvider(inserter); nodeIndex = indexProvider.nodeIndex("nodeIndex", MapUtil.stringMap("type", "exact")); // TODO: Does this have an effect at all? nodeIndex.setCacheCapacity(NodeKeys.TYPE, 100000); nodeIndex.setCacheCapacity(NodeKeys.NAME, 100000); nodeIndex.setCacheCapacity(NodeKeys.CODE, 100000); }
@Ignore @Test public void testInsertionSpeed() { BatchInserter inserter = BatchInserters.inserter(new File(PATH, "3").getAbsolutePath()); BatchInserterIndexProvider provider = new LuceneBatchInserterIndexProvider(inserter); BatchInserterIndex index = provider.nodeIndex("yeah", EXACT_CONFIG); index.setCacheCapacity("key", 1000000); long t = currentTimeMillis(); for (int i = 0; i < 1000000; i++) { Map<String, Object> properties = map("key", "value" + i); long id = inserter.createNode(properties); index.add(id, properties); } System.out.println("insert:" + (currentTimeMillis() - t)); index.flush(); t = currentTimeMillis(); for (int i = 0; i < 1000000; i++) { count((Iterator<Long>) index.get("key", "value" + i)); } System.out.println("get:" + (currentTimeMillis() - t)); }