@Deprecated @Override public BatchInserterIndex nodeIndex( String indexName, Map<String, String> config ) { return provider.nodeIndex( indexName, config ); }
public void indexNodeUsingBatchIndexer(BatchInserterIndexProvider indexProvider, EntityMetadata entityMetadata, long nodeId, Map<String, Object> nodeProperties, boolean nodeAutoIndexingEnabled) { BatchInserterIndex nodeIndex = null; if (!nodeAutoIndexingEnabled && entityMetadata.isIndexable()) { nodeIndex = indexProvider.nodeIndex(entityMetadata.getIndexName(), MapUtil.stringMap("type", "exact")); } else { nodeIndex = indexProvider.nodeIndex("node_auto_index", MapUtil.stringMap("type", "exact")); } if (nodeIndex != null) nodeIndex.add(nodeId, nodeProperties); }
private BatchInserterIndex nodeIndexFor(String indexName, String indexType) { return indexProvider.nodeIndex(indexName, configFor(indexType)); }
@Inject public GraphBatchImpl(BatchInserter inserter, @IndicatesUniqueProperty String uniqueProperty, @IndicatesIndexedProperties Set<String> indexedProperties, @IndicatesExactIndexedProperties Set<String> exactIndexedProperties, ConcurrentMap<String, Long> idMap, RelationshipMap relationshioMap) { this.inserter = inserter; this.idMap = idMap; this.relationshipMap = relationshioMap; indexProvider = new LuceneBatchInserterIndexProvider(inserter); nodeIndex = indexProvider.nodeIndex("node_auto_index", INDEX_CONFIG); this.uniqueProperty = uniqueProperty; this.indexedProperties = newHashSet(indexedProperties); this.indexedProperties.add(uniqueProperty); this.indexedExactProperties = newHashSet(exactIndexedProperties); }
public <T extends Element> Index<T> createIndex(final String indexName, final Class<T> indexClass, final Parameter... indexParameters) { final Neo4jBatchIndex<T> index; final Map<String, String> map = generateParameterMap(indexParameters); if (indexParameters.length == 0) { map.put(Neo4jBatchTokens.TYPE, Neo4jBatchTokens.EXACT); } if (Vertex.class.isAssignableFrom(indexClass)) { index = new Neo4jBatchIndex<T>(this, indexProvider.nodeIndex(indexName, map), indexName, indexClass); } else { index = new Neo4jBatchIndex<T>(this, indexProvider.relationshipIndex(indexName, map), indexName, indexClass); } this.indices.put(indexName, index); return index; }
public <T extends Element> Index<T> createIndex(final String indexName, final Class<T> indexClass, final Parameter... indexParameters) { final Neo4j2BatchIndex<T> index; final Map<String, String> map = generateParameterMap(indexParameters); if (indexParameters.length == 0) { map.put(Neo4j2BatchTokens.TYPE, Neo4j2BatchTokens.EXACT); } if (Vertex.class.isAssignableFrom(indexClass)) { index = new Neo4j2BatchIndex<T>(this, indexProvider.nodeIndex(indexName, map), indexName, indexClass); } else { index = new Neo4j2BatchIndex<T>(this, indexProvider.relationshipIndex(indexName, map), indexName, indexClass); } this.indices.put(indexName, index); return index; }
public void indexNodeUsingBatchIndexer(BatchInserterIndexProvider indexProvider, EntityMetadata entityMetadata, long nodeId, Map<String, Object> nodeProperties, boolean nodeAutoIndexingEnabled) { BatchInserterIndex nodeIndex = null; if (!nodeAutoIndexingEnabled && entityMetadata.isIndexable()) { nodeIndex = indexProvider.nodeIndex(entityMetadata.getIndexName(), MapUtil.stringMap("type", "exact")); } else { nodeIndex = indexProvider.nodeIndex("node_auto_index", MapUtil.stringMap("type", "exact")); } if (nodeIndex != null) nodeIndex.add(nodeId, nodeProperties); }
@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(); } }