使用Neo4j架构索引时为什么不返回任何结果?

时间:2013-11-20 23:21:26

标签: indexing neo4j cypher

我正在使用Neo4j 2.0.0-M06社区版。

我创建了以下架构索引

CREATE INDEX ON :Merchant(MerchantId);

此查询返回25个结果,每个结果都有一个填充的MerchantId。

MATCH (m:Merchant) RETURN m LIMIT 25

如果我选择一个MerchantId进行过滤并将其粘贴到另一个查询中,我会得到0个结果。

MATCH (m:Merchant)
WHERE m.MerchantId = "1"
RETURN m

如果我运行查询以选择前商家名为NULL MerchantId,则会获得25个结果

MATCH (m:Merchant)
WHERE m.MerchantId IS NULL
RETURN m
LIMIT 25

奇怪的是,如果我看看Fiddler 我会收到我明确排除的结果!

   "results":[{"columns":["m"],"data":[
         {"row":[{"MerchantId":"1"}],"graph":{"nodes":[{"id":"2696940","labels":["Merchant"],"properties":{"MerchantId":"1"}}],"relationships":[]}},
         {"row":[{"MerchantId":"2"}],"graph":{"nodes":[{"id":"2696941","labels":["Merchant"],"properties":{"MerchantId":"2"}}],"relationships":[]}},
         {"row":[{"MerchantId":"3"}],"graph":{"nodes":[{"id":"2696942","labels":["Merchant"],"properties":{"MerchantId":"3"}}],"relationships":[]}},
  ...................

这可能是什么原因?

1 个答案:

答案 0 :(得分:1)

我明白了。

我最初使用Micahel Hunger's CSV to Neo4j batch importer批量加载了我的数据。这是我用来导入数据的命令

java -server -Dfile.encoding=UTF-8 -Xmx4G -jar batch-import-jar-with-dependencies.jar target Merchants.csv relationships.csv

使用Notepad2打开我的CSV文件,我检查了编码并将其设置为“带签名的UTF-8”

我将编码更改为ANSI,从命令行中删除了文本 -Dfile.encoding = UTF-8 ,然后重新导入了我的所有数据。

现在,我创建的索引正在按预期工作。