You definately found a bug. I'll try to fix it today so that it is fixed in the next milestone. Thanks for the report and I'll get back to you here when it is done!
2010/11/4, Balazs E. Pataki <pat...@dsd.sztaki.hu>: > Hi, > > I don't know if it is a bug or not, but the following code: > > GraphDatabaseService graphDb = new > EmbeddedGraphDatabase("x-lucene-indexer-bug"); > Transaction tx = graphDb.beginTx(); > try { > Node n1 = graphDb.createNode(); > Node n2 = graphDb.createNode(); > Relationship r = n1.createRelationshipTo(n2, > DynamicRelationshipType.withName("foo")); > graphDb.index().forRelationships("rel-index").remove(r, "bar", "value"); > graphDb.index().forRelationships("rel-index").add(r, "bar", > "otherValue"); > tx.success(); > } finally { > tx.finish(); > } > > causes this exception: > > java.lang.ClassCastException: java.lang.Long cannot be cast to > org.neo4j.index.impl.lucene.RelationshipId > at > org.neo4j.index.impl.lucene.LuceneDataSource$4.newDocument(LuceneDataSource.java:180) > at > org.neo4j.index.impl.lucene.CommitContext.getDocument(CommitContext.java:94) > at > org.neo4j.index.impl.lucene.LuceneCommand$RemoveCommand.perform(LuceneCommand.java:220) > at > org.neo4j.index.impl.lucene.LuceneTransaction.doCommit(LuceneTransaction.java:233) > at > org.neo4j.kernel.impl.transaction.xaframework.XaTransaction.commit(XaTransaction.java:319) > at > org.neo4j.kernel.impl.transaction.xaframework.XaResourceManager.commit(XaResourceManager.java:440) > at > org.neo4j.kernel.impl.transaction.xaframework.XaResourceHelpImpl.commit(XaResourceHelpImpl.java:65) > at > org.neo4j.kernel.impl.transaction.TransactionImpl.doCommit(TransactionImpl.java:517) > at > org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:621) > at > org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:584) > at > org.neo4j.kernel.impl.transaction.TransactionImpl.commit(TransactionImpl.java:105) > at > org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:86) > > > What is unusual here is that I try to remove a Relationship from the > index without adding it first. Why I tried this? > > As far as I know, there is no way to know (by asking from the Index or > IndexManager) whether a relationship (or node) has been indexed before > with a given key and value or not. So, to be safe I remove the > Relationship with the key and value I suppose it has and then add it > again with a new value for the same key. Maybe it is not reasonable to > do so, but nevertheless I think it should not throw the above exception > in this case. Or should it? Should I produce the same exception > semantics in our own indexer (SphinxProvider) as well? > > Regards, > --- > balazs > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user