【发布时间】:2013-12-27 09:18:30
【问题描述】:
当尝试在密码中使用自动索引查询节点时,它会返回不相关的节点, 如下所示,我查询了具有 contno='GESU5697150' 的节点,但它也返回了其他一些节点。
neo4j-sh (0)$ start n=node:node_auto_index(contno='GESU5697150') return n;
==> +----------------------------------------------------+
==> | n |
==> +----------------------------------------------------+
==> | Node[546290]{contno:"UACU5047693",sizetype:"40HC"} |
==> | Node[700914]{contno:"GESU5697150",sizetype:"40HC"} |
==> +----------------------------------------------------+
==> 2 rows
这是 cypher / Neo4j 问题吗?!因此,我在获取 java 代码记录时遇到了问题
Ncontno = autoNodeIndex.get("contno", contno).getSingle();
它会抛出以下错误
Exception in thread "main" java.util.NoSuchElementException: More than one eleme
nt in org.neo4j.index.impl.lucene.LuceneIndex$1@211b3c6a. First element is 'Node
[546290]' and the second element is 'Node[700914]'
【问题讨论】:
-
您能否分享一下您为导入数据所做的工作?
-
@Michael Hunger ,在代码下方使用
firstNode = null; firstNode = graphDb.createNode(); firstNode.setProperty("contno", contno); firstNode.setProperty("sizetype", sizetype); container.add(firstNode, "contno", contno); container.add(firstNode, "sizetype",sizetype);