[Blueprints] Neo4j query capabilities with Blueprints Index

180 views
Skip to first unread message

Marko Rodriguez

unread,
Feb 8, 2011, 8:30:31 PM2/8/11
to gremlin-users
Hi,

A fellow emailed me privately asking me if Blueprints supported Lucene querying over Neo4j.

I said: "No. Neo4jIndex uses index.get(), not index.query()." Then I said: "I shall rectify this."

So I did. Its a bit of a hack, but I think its nice.

Check it:
http://paste.pocoo.org/show/334747/
(NOTE: I'm using full Java notation so its apparent what to do if you are in Blueprints -- not Gremlin).

In short, if you append Neo4jTokens.QUERY_HEADER to your value in a Neo4jIndex.get() call, it will know that you want to do a Lucene-style query. Right now, Neo4jTokens.QUERY_HEADER == "%query%" (WARNING: may change, use Neo4jTokens.QUERY_HEADER to be safe).

Its a hack.... any other ideas are more than welcome. ???

I've committed the code to GitHub and updated Blueprints 0.5-SNAPSHOT in the TinkerPop Maven2 repository with the latest deployment.

LUCA: Does OrientDB support such text searching? Should we add this too OrientGraph?

Thoughts?,
Marko.

http://markorodriguez.com

Luca Garulli

unread,
Feb 8, 2011, 8:51:58 PM2/8/11
to gremlin-users
Hi Marko,
yes OrientDB has similar feature but it's not Lucene under the hood. Could you leave it just as a String?

Lvc@

Marko Rodriguez

unread,
Feb 8, 2011, 9:13:32 PM2/8/11
to gremli...@googlegroups.com
Hi,

Its simply a String for Neo4j.
graph.getIndex(Index.VERTICES, Vertex.class).get("name", Neo4jTokens.QUERY_HEADER + "*rko")
graph.getIndex(Index.EDGES, Edge.class).get("label", Neo4jTokens.QUERY_HEADER + "k?ows")
graph.getIndex(Index.EDGES, Edge.class).get("weight", Neo4jTokens.QUERY_HEADER + "[0.5 TO 1.0]")

In OrientGraph, does this already exist or is there something special that needs to be done? Meaning, if I do:

OrientIndex.get("name", "*STAR") will that work as is right now? Or do we need to do some sort of OrientTokens.QUERY_HEADER model too?

Thanks,
Marko.

James Thornton

unread,
Apr 16, 2011, 7:50:26 AM4/16/11
to gremli...@googlegroups.com
Any way yet to do this from rexster?

Marko Rodriguez

unread,
Apr 16, 2011, 8:04:20 AM4/16/11
to gremli...@googlegroups.com
Hi,

> Any way yet to do this from rexster?

Do you mean Lucene wildcards?

Do: key=name&value=%25query%25ma*
-> marko
-> mattias
-> mat
etc.

Marko.

http://markorodriguez.com

Pierre De Wilde

unread,
Apr 16, 2011, 8:17:17 AM4/16/11
to gremli...@googlegroups.com
=> {"version":"0.3-SNAPSHOT","results":[],"total_size":0,"query_time":0.772096}

?
2011/4/16 Marko Rodriguez <okram...@gmail.com>

Marko Rodriguez

unread,
Apr 16, 2011, 8:21:58 AM4/16/11
to gremli...@googlegroups.com
Sorry -- only works for Neo4jGraph. Its a "hack" to allow people to use Lucene aspects of Neo4j.

Marko.
Reply all
Reply to author
Forward
0 new messages