/** * This is required before querying the index for data. * This method is not a standard Index API method and thus, be sure to typecast the index to Neo4j2BatchIndex. */ public void flush() { this.rawIndex.flush(); }
/** * This is required before querying the index for data. * This method is not a standard Index API method and thus, be sure to typecast the index to Neo4jBatchIndex. */ public void flush() { this.rawIndex.flush(); }
@Override public void flush() { index.flush(); }
private void flushIndexes() { for (BatchInserterIndex index : indexes.values()) { index.flush(); } }
@Override public void shutdown() { index(); nodeIndex.flush(); indexProvider.shutdown(); inserter.shutdown(); }
long caller = db.createNode(map("Number", number)); phoneNumberIndex.add(caller, map("Number", number)); phoneNumberIndex.flush(); return caller;
@Test public void testBatchIndexToAutoIndex() throws IOException { BatchInserter inserter = BatchInserters.inserter(new File(path)); BatchInserterIndexProvider indexProvider = new LuceneBatchInserterIndexProvider(inserter); BatchInserterIndex index = indexProvider.nodeIndex("node_auto_index", MapUtil.stringMap("type", "exact")); long node = inserter.createNode(MapUtil.map("foo", "bar")); index.add(node, MapUtil.map("foo", "bar")); index.flush(); assertThat("Batch indexed node can be retrieved", index.get("foo", "bar").next(), is(node)); indexProvider.shutdown(); inserter.shutdown(); graphDb = getGraphDb(); try (Transaction tx = graphDb.beginTx()) { assertThat("AutoIndex is not enabled after reopening the graph", graphDb.index() .getNodeAutoIndexer().isEnabled(), is(false)); assertThat("AutoIndexed properties are not maintained after closing the graph", graphDb .index().getNodeAutoIndexer().getAutoIndexedProperties(), is(empty())); assertThat("Batch index properties are in the index", graphDb.index().getNodeAutoIndexer() .getAutoIndex().query("foo", "bar").size(), is(1)); tx.success(); } }