recordKeyValueIndex = new OIndexTxAwareOneValue(graph.getRawGraph(), (OIndex<OIdentifiable>) graph.getRawGraph()
.getMetadata().getIndexManager().getIndex(recordKeyValueMap));
}
private OIndex<?> buildKeyValueIndex(ODocument metadata) {
OIndex<?> recordKeyValueIndex = new OIndexTxAwareOneValue(graph.getRawGraph(), (OIndex<OIdentifiable>) graph
.getRawGraph()
.getMetadata()
.getIndexManager()
.createIndex("__@recordmap@___" + underlying.getName(), OClass.INDEX_TYPE.DICTIONARY.toString(),
new OSimpleKeyIndexDefinition(OType.LINK, OType.STRING), null, null, null));
final List<ODocument> entries = graph.getRawGraph().query(
new OSQLSynchQuery<Object>("select from index:" + underlying.getName()));
for (ODocument entry : entries) {
final OIdentifiable rid = entry.field("rid");
if (rid != null)
recordKeyValueIndex.put(new OCompositeKey(rid, entry.field("key")), rid);
}
metadata.field(CONFIG_RECORD_MAP_NAME, recordKeyValueIndex.getName());
return recordKeyValueIndex;
}