I am having strange issue with my batch inserter. The batch inserter works fine but when I start the server from that location, CYPHER is not able to filter on property.
Query "match(a) return a" returns all nodes. But the moment I try to filter it based on any property then it does not return any row. Query match(a) where a.Name="Someone" return a does not return anything.
If I run run SET command to update the property then I am able to filter it fine. Looks like index issue but not able to figure out exactly.
**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();
}