neo4j/spatial — Issue #20: Unable to load the same OSM data in two different layers.
Author: svzdvd
Created: 2011-10-14 12:52:54+00:00
State: open

Exception:

```
java.util.NoSuchElementException: More than one element in org.neo4j.index.impl.lucene.LuceneIndex$1@7b7d1256. First element is 'Node[14]' and the second element is 'Node[2042]'
at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:116)
at org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:88)
at org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:1)
at org.neo4j.gis.spatial.osm.OSMImporter$OSMGraphWriter.getOSMNode(OSMImporter.java:917)
at org.neo4j.gis.spatial.osm.OSMImporter$OSMGraphWriter.getOSMNode(OSMImporter.java:727)
at org.neo4j.gis.spatial.osm.OSMImporter$OSMWriter.createOSMWay(OSMImporter.java:575)
at org.neo4j.gis.spatial.osm.OSMImporter.importFile(OSMImporter.java:1480)
at org.neo4j.gis.spatial.osm.OSMImporter.importFile(OSMImporter.java:1314)
at org.neo4j.gis.spatial.osm.OSMImporter.importFile(OSMImporter.java:1306)
```

The following Lucene search finds more than one Node and throws an exception. Only the Node inside the current Layer should be returned:

```java
Node node = changesetNodes.get(osmId);
if (node == null) {
logNodeFoundFrom("node-index");
return indexFor("node").get("node_osm_id", osmId).getSingle();
} else {
logNodeFoundFrom("changeset");
return node;
}
```