Search code examples
neo4jlucenetinkerpoprexster

Rexster extension using Neo4j Lucene index


I'm trying to write a Rexster extension in Java that among other things queries nodes using Neo4j 2.0 Lucene indices.

From the few threads I was able to find (mostly old Google Group threads), it doesn't seem to be possible using Blueprint's Graph.

I thought about a possible solution where I access the underlying Neo4jGraph class from the extension's:

@RexsterContext Graph graph

parameter, but I'm not sure how to do this.

The end-goal ideally, would be to use an automatic get-or-create-index method which could be called with a piece of text on a Lucene index.

Any ideas ?

Thank you in advance!


Solution

  • I think you said the answer here:

    I thought about a possible solution where I access the underlying Neo4jGraph class from the extension's:

    @RexsterContext Graph graph

    If you need methods from Blueprints Neo4jGraph then just cast Graph to that:

    Neo4jGraph neo4j = (Neo4jGraph) neo4j;
    

    Furthermore, if you need to work with specific, native Neo4j classes/methods then just do:

    GraphDatabaseService graphdb = neo4j.getRawGraph()
    

    Obviously both of these approaches makes your Rexster Extension Neo4j specific but it sounds like that is ok for your case.