本文整理汇总了Java中org.neo4j.unsafe.batchinsert.BatchInserterIndexProvider.relationshipIndex方法的典型用法代码示例。如果您正苦于以下问题:Java BatchInserterIndexProvider.relationshipIndex方法的具体用法?Java BatchInserterIndexProvider.relationshipIndex怎么用?Java BatchInserterIndexProvider.relationshipIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.neo4j.unsafe.batchinsert.BatchInserterIndexProvider
的用法示例。
在下文中一共展示了BatchInserterIndexProvider.relationshipIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOrCreateIndex
import org.neo4j.unsafe.batchinsert.BatchInserterIndexProvider; //导入方法依赖的package包/类
protected Tuple<BatchInserterIndex, BatchInserterIndexProvider> getOrCreateIndex(final String name, final String property,
final boolean nodeIndex, final int cachSize) {
final BatchInserterIndexProvider indexProvider = new LuceneBatchInserterIndexProvider(inserter);
final BatchInserterIndex index;
if (nodeIndex) {
index = indexProvider.nodeIndex(name, MapUtil.stringMap("type", "exact"));
} else {
index = indexProvider.relationshipIndex(name, MapUtil.stringMap("type", "exact"));
}
index.setCacheCapacity(property, cachSize);
return Tuple.tuple(index, indexProvider);
}
示例2: run
import org.neo4j.unsafe.batchinsert.BatchInserterIndexProvider; //导入方法依赖的package包/类
public static void run(final String neo4storage,
final String redisQueueName, final String redisHost) {
ObelixQueue redisQueueManager = new RedisObelixQueue(redisQueueName, redisHost);
Label userLabel = DynamicLabel.label("User");
Label itemLabel = DynamicLabel.label("Item");
Map<String, Long> usersNodesMap = new HashMap<>();
Map<String, Long> itemsNodesMap = new HashMap<>();
Map<String, Long> relationshipsMap = new HashMap<>();
Map<String, String> config = new HashMap<>();
config.put("neostore.nodestore.db.mapped_memory", "2G");
config.put("neostore.relationshipstore.db.mapped_memory", "9G");
config.put("neostore.propertystore.db.mapped_memory", "800M");
config.put("neostore.propertystore.db.strings.mapped_memory", "800M");
config.put("neostore.propertystore.db.arrays.mapped_memory", "500M");
BatchInserter inserter;
inserter = BatchInserters.inserter(neo4storage, config);
BatchInserterIndexProvider indexProvider = new LuceneBatchInserterIndexProvider(inserter);
registerShutdownHook(inserter, indexProvider);
BatchInserterIndex usersIndex = indexProvider.nodeIndex("users",
MapUtil.stringMap("type", "exact"));
usersIndex.setCacheCapacity("node_id", NEO_CACHE_CAPACITY);
BatchInserterIndex itemsIndex = indexProvider.nodeIndex("items",
MapUtil.stringMap("type", "exact"));
usersIndex.setCacheCapacity("node_id", NEO_CACHE_CAPACITY);
BatchInserterIndex relationshipIndex = indexProvider.relationshipIndex("relationships",
MapUtil.stringMap("type", "exact"));
usersIndex.setCacheCapacity("timestamp", NEO_CACHE_CAPACITY);
boolean notFinised = true;
int c = 0;
while (notFinised) {
ObelixQueueElement result = redisQueueManager.pop();
if (result == null) {
notFinised = false;
}
if (result != null) {
NeoEvent event = getEvent(result.toString());
if (event == null) {
continue;
}
long userid = getOrCreateUserNodeID(event.getUser(), usersNodesMap,
usersIndex, inserter, userLabel);
long itemid = getOrCreateItemNodeID(event.getItem(), itemsNodesMap,
itemsIndex, inserter, itemLabel);
getOrCreateRelatinshipID(event.getTimestamp(),
userid, itemid, relationshipsMap, relationshipIndex,
inserter, NeoHelpers.RelTypes.VIEWED);
}
c += 1;
if (c % IMPORTS_BETWEEN_EACH_LOG_MESSAGE == 0) {
LOGGER.info("Imported " + c);
}
}
}