[英]Neo4j - get all nodes belonging to an index using Java API
假設我有一個名為“user”的索引。 如何使用Neo4j-Java Api獲取屬於該索引的所有節點?
我試過下面的代碼
val nodeIndex = getNodeIndex("article").get
val nodes = nodeIndex.getGraphDatabase().getAllNodes()
但是,我得到了db中存在的所有節點。 我該如何解決這個問題?
你應該在nodeIndex上使用“get”或“query”,如:
IndexHits<Node> allArticles = nodeIndex.query( "*:*" );
... do stuff ...
allArticles.close();
or
Node myArticle = nodeIndex.get( "name", "MyArticle" ).getSingle();
你上面做的是無論索引如何,獲取圖形數據庫並返回所有節點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.