I'm attempting to implement a quite simple fuzzy match using a lucene index. I'm running into multiple issues surrounding exceptions thrown by Lucene, and how neo4j interacts with them.
Sometimes, lucene will throw mysterious NullPointerExceptions which propogate all the way up. These are quite frustrating, since there's really nowhere to go; no indication of what's wrong with the syntax. Example reference: https://stackoverflow.com/questions/22637914/overcoming-nullpointerexception-on-cypher-lucene-query Other times, lucene exceptions get transformed into RuntimeExceptions, when certain syntax mistakes are made (example below, with syntax mistake illustrated). The execute() method on an ExecutionEngine object has a signature which includes the possibility of throwing a CypherException. Is there a reason these things don't get swept into CypherExceptions (optionally/hopefully with informative messages about what went wrong)? My immediate functionality issue is that I'm finding if I run a lucene query such as name:Chain~ then this query will fail to return nodes whose name is things like "Chain: 3" and "Chain: 1". I'm more than happy to RTFM if someone can point me to the appropriate reference, but shouldn't there be a match there? The design concern is just that I'm having a bit of a hard time with lucene query because lucene will sometimes fail with no message at all other than NullPointerException. This necessitates special handling, above/beyond handling of CypherException, which is possibly to be expected. java.lang.RuntimeException: org.apache.lucene.queryParser.ParseException: Cannot parse 'name:Chain:~': Encountered " ":" ": "" at line 1, column 10. Was expecting one of: <EOF> <AND> ... <OR> ... <NOT> ... "+" ... "-" ... <BAREOPER> ... "(" ... "*" ... "^" ... <QUOTED> ... <TERM> ... <FUZZY_SLOP> ... <PREFIXTERM> ... <WILDTERM> ... "[" ... "{" ... <NUMBER> ... at org.neo4j.index.impl.lucene.IndexType.query(IndexType.java:307) at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:251) at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:263) at org.neo4j.kernel.impl.coreapi.AbstractAutoIndexerImpl$ReadOnlyIndexToIndexAdapter.query(AbstractAutoIndexerImpl.java:249) at org.neo4j.cypher.internal.spi.v2_0.TransactionBoundExecutionContext$NodeOperations.indexQuery(TransactionBoundExecutionContext.scala:166) -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
