Neo4j批插入器和TimelineIndex[v1.9.4]
我使用BatchInserterIndex将大量数据摄取到Neo4j DB。我打算在批处理期间向TimelineIndex(Lucene)添加节点。现在,按照正常方式,TimelineIndex需要(节点,长)才能添加到索引中。它可能在内部使用键“timestamp”。(在github中的luceTimeLine.java中签入) 我的问题是,我能够将节点插入TL索引,但无法使用常规JavaAPI检索它们。它总是将timelineIndex.getFirst()返回为null。 我已经初始化了索引,如下所示 常规访问方式Neo4j批插入器和TimelineIndex[v1.9.4],neo4j,batch-insert,Neo4j,Batch Insert,我使用BatchInserterIndex将大量数据摄取到Neo4j DB。我打算在批处理期间向TimelineIndex(Lucene)添加节点。现在,按照正常方式,TimelineIndex需要(节点,长)才能添加到索引中。它可能在内部使用键“timestamp”。(在github中的luceTimeLine.java中签入) 我的问题是,我能够将节点插入TL索引,但无法使用常规JavaAPI检索它们。它总是将timelineIndex.getFirst()返回为null。 我已经初始化了索
TimelineIndex<Node> timelineIndex = new LuceneTimeline<Node>(graphDB, indexMgr.forNodes("airing-timeline")); //graphDb initialised properly earlier.
timelineIndex.add(node, 1234560000L);
TimelineIndex TimelineIndex=新的LuceTimeLine(graphDB,indexMgr.forNodes(“播放时间线”)//graphDb之前已正确初始化。
timelineIndex.add(节点,12345600000L);
批量摄入
BatchInserterIndex timelineIndex = indexProvider.nodeIndex("airing-timeline", MapUtil.stringMap("type", "exact")); //Initialised just like regular way
Map<String, Object> timelineIndexPropertiesMap = new HashMap<String, Object>();
timelineIndexPropertiesMap.put("timestamp", 1234560000L); //Checked the code of LuceneTimeline.java and found this internal property for timeline
timelineIndex.query("*:*").size(); // return 0 (zero)
timelineIndex.add(airing_node_id, timelineIndexPropertiesMap);
timelineIndex.query("*:*").size(); // return 1 (one)
BatchInserterIndex timelineIndex=indexProvider.nodeIndex(“播放时间线”,MapUtil.stringMap(“类型”,“精确”)//像常规方式一样初始化
Map timelineIndexPropertiesMap=新HashMap();
timelineIndexPropertiesMap.put(“时间戳”,12345600000L)//检查了LuceNet timeline.java的代码,并找到了timeline的此内部属性
timelineIndex.query(“*:*”).size();//返回0(零)
添加(播放节点id,timelineIndexPropertiesMap);
timelineIndex.query(“*:*”).size();//返回1(一)
现在,当我试图使用timelineIndex.getFirst()检索Batch Inserter添加的数据时,它总是返回null。
但是,在同一数据库上以常规方式添加的节点会返回正确的值
哪里出错了?在插入timelineindex的BatchInserterIndex方法中,键应该是“timestamp”,值应该是数值类型的ValueContext的实例。 因此,您需要调用静态函数ValueContext.numeric(value)
timelineIndexPropertiesMap.put(“时间戳”,ValueContext.numeric(12345678L);
访问timelineindex值的方法是相同的