Ejemplo n.º 1
0
  @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));
  }
Ejemplo n.º 2
0
 public static IndexHits<Long> retrieveExactFromIndex(String key, String value) {
   return nodeIndex.get(key, value);
 }