2014-01-06 3 views
1

BatchInserterIndex를 사용하여 많은 양의 데이터를 Neo4j DB에 수집합니다. 배치 중에 TimelineIndex (Lucene)에 노드를 추가하려고합니다. 이제는 일반적인 방법으로 TimelineIndex가 (node, long) 인덱스를 추가합니다. 아마 내부적으로 '타임 스탬프'키를 사용하고있을 것입니다. (github의 LuceneTimeline.java에서 확인)Neo4j BatchInsx 및 TimelineIndex [v1.9.4]

내 문제는 노드를 TL 인덱스에 삽입 할 수 있지만 일반 Java API를 사용하여 노드를 검색 할 수 없다는 점입니다. 항상 timelineIndex.getFirst()를 null로 반환합니다. 다음과 같이 색인을 초기화했습니다. 내가 사용하려고 해요 때

액세스의

정기 방법

TimelineIndex<Node> timelineIndex = new LuceneTimeline<Node>(graphDB, indexMgr.forNodes("airing-timeline")); //graphDb initialised properly earlier. 
timelineIndex.add(node, 1234560000L); 

배치 섭취 이제

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) 
, timelineIndex.getFirst()는 데이터를 검색 할 Batch Inserter에 의해 추가되면 항상 null을 반환합니다. 그러나 SAME DB에 정기적으로 추가 된 노드는 적절한 값을 반환합니다.

어디로 잘못 가고 있습니까?

답변

0

timelineindex에 삽입하는 BatchInserterIndex 메서드에서 키는 "timestamp"이고 값은 numeric 유형의 ValueContext 인스턴스 여야합니다. 그래서, 당신은 동일 할 것이다 timelineindex 값에 액세스 할 수

timelineIndexPropertiesMap.put("timestamp", ValueContext.numeric(12345678L);

방법을 정적 기능 ValueContext.numeric (값)를 호출해야합니다.