我的批量插入器出现了奇怪的问题。批量插入器工作正常,但是当我从该位置启动服务器时,CYPHER无法对属性进行过滤。
查询"match(a) return a"
返回所有节点。但是,当我尝试根据任何属性过滤它时,它不会返回任何行。查询match(a) where a.Name="Someone" return a
不会返回任何内容。
如果我运行运行SET命令来更新属性,那么我可以很好地过滤它。看起来像索引问题,但无法弄清楚。
**Output of - `match(a) return a` -** ╒══════════════════════════════╕ │a │ ╞══════════════════════════════╡ │{} │ ├──────────────────────────────┤ │{Company: "Neo Technology", ye│ │ar: 2013, Name: "Kenny Bastani│ │"} │ ├──────────────────────────────┤ │{Company: "Neo Technology", ye│ │ar: 2010, Name: "Michael Hunge│ │r"} │ ├──────────────────────────────┤ │{Company: "Heroku", year: 2011│ │, Name: "James Ward"} │ ├──────────────────────────────┤ │{Name: "Someone"} │ ├──────────────────────────────┤ │{Company: "Doe.com", year: "ni│ │netynine", Name: "John"} │ └──────
**File -** Name,Company,year "Kenny Bastani","Neo Technology",2013 "Michael Hunger","Neo Technology",2010 "James Ward","Heroku",2011 "Someone",, "John","Doe.com","ninetynine"
**Batch Inserter-** public void importNodes() throws IOException { FileInputStream fis = new FileInputStream( "E:\\neo4j\\CSV_Import\\01.csv"); InputStreamReader isr = new InputStreamReader(fis); BufferedReader br = new BufferedReader(isr); String line = null; File storeDir = new File("E:\\neo4j\\test_data1"); FileUtils.deleteRecursively(storeDir); BatchInserter neoBatchInserter = BatchInserters.inserter(storeDir); Map properties = new HashMap(); ArrayList headerMap = new ArrayList(); BatchInserterIndexProvider indexProvider = new LuceneBatchInserterIndexProvider( neoBatchInserter); BatchInserterIndex autoIndex = indexProvider.nodeIndex("node_auto_index", MapUtil.stringMap("type", "exact")); autoIndex.setCacheCapacity( "Name", 10000 ); neoBatchInserter.createDeferredSchemaIndex(Labels.Person).on("Name").create(); String propertyName = ""; boolean headerFlag = true; int counter = 0; while ((line = br.readLine()) != null) { String[] values = line.split(","); for (String value : values) { if (headerFlag) { headerMap.add(value); } else { propertyName = headerMap.get(counter); properties.put(propertyName, value); } counter++; } System.out.println("New Node - " + properties); long node = neoBatchInserter.createNode(properties, Labels.Person); autoIndex.add(node, properties); autoIndex.flush(); counter = 0; properties.clear(); headerFlag = false; } indexProvider.shutdown(); neoBatchInserter.shutdown(); }
答案 0 :(得分:0)
如果是索引问题,删除并重新创建索引可能会修复它。