JanusGraph / janusgraph

JanusGraph: an open-source, distributed graph database
https://janusgraph.org
Other
5.2k stars 1.16k forks source link

Use indices for TinkerPop Text Predicates #1565

Open FlorianHockmann opened 5 years ago

FlorianHockmann commented 5 years ago

TinkerPop added its own text predicates in version 3.4.0 with the goal to provide a unified API also for text searches across providers. While JanusGraph already has its own text predicates, it makes sense for us to provide good support for these TinkerPop text predicates so users have a good experience with JanusGraph. Right now we support the TinkerPop text predicates, but they cannot make use of any indices. We should try to use an index if possible.

A complete list of the TinkerPop predicates can be found in the reference docs.

FlorianHockmann commented 4 years ago

We could implement this with a traversal strategy that converts all TinkerPop text predicates into JanusGraph text predicates. We would only need a solution for predicates where we don't have an equivalent like TextP.startingWith(string). A possible solution would be to convert this into a regex. (Further discussion on gremlin-users where @spmallette suggested the approach of using a TraversalStrategy.)

jrflowersjr commented 2 years ago

hi, I'm a long-time Janus proponent at my company and am facing this issue as well using Janus v0.5.3 w/ElasticSearch deployed and the gremlin-javascript driver v3.5.1.

IMO if ES is deployed and there are TEXT and/or STRING mixed indices present for a property they should be used by default, or via some server-side config. Ideally a rev. of the JS driver should also expose the Janus/Elastic Text.* predicates as with Java driver and use those indices.

Lack of above means 1) I have to rewrite app using Java driver or 2) drop use of Janus at my company.

Can we get this issue reopened and scheduled? I'd be happy to help in any way I can.

li-boxuan commented 2 years ago

@jrflowersjr Rather than rewrite the app using java driver, it might be easier to modify JanusGraph source code (e.g. adding a new traversal strategy as suggested in the opening comment) and build your own JanusGraph. If you manage to do that, it would be great if you can contribute back to the community! Otherwise we need to wait until someone is interested to tackle this issue.

farodin91 commented 2 years ago

I think with the upcoming version of JG, it will pretty easy to implement the predicates on the fly.

jrflowersjr commented 2 years ago

@farodin91 is there a beta version of the above I could test?

farodin91 commented 2 years ago

I think the release in the coming weeks. (You could download the latest master build artifact in the GitHub action of the release tests) I would like to provide an example, but I'm currently on vacation. I can just point you to some locations, how it could work.

jrflowersjr commented 2 years ago

will do, thanks

jrflowersjr commented 2 years ago

hi.

re: using v0.6.0 full, I upgraded my service code from 0.5.3 using current config

My service mostly works, but it crashes when I use a script to create a new property programmatically (a regression):

graph.openManagement().makePropertyKey('foo').dataType(String.class).cardinality(org.janusgraph.core.Cardinality.SINGLE).make()

Error is connection._handleMessage() gets invalid JSON back and it doesn't handle undefined response. At one point I saw an embedded stack trace complaining server couldn't find groovy-2.5.7-indy.jar (0.6.0 has 2.5.14) but janus logs aren't dumping to /logs dir any longer.

The above works in gremlin console.

Questions:

  1. how to get janus logs working?
  2. does v0.6 support GraphSONMessageSerializerV2d0 and scripts?
  3. where to post the javascript gremlin lib error described above?

Thanks! -Jim

jrflowersjr commented 2 years ago

hi.

re: using v0.6.0 full, I upgraded my service code from 0.5.3 using current config

  • latest javascript gremlin lib 3.5.1
  • GraphSONMessageSerializerV2d0
  • fluent queries

My service mostly works, but it crashes when I use a script to create a new property programmatically (a regression):

graph.openManagement().makePropertyKey('foo').dataType(String.class).cardinality(org.janusgraph.core.Cardinality.SINGLE).make()

Error is connection._handleMessage() gets invalid JSON back and it doesn't handle undefined response. At one point I saw an embedded stack trace complaining server couldn't find groovy-2.5.7-indy.jar (0.6.0 has 2.5.14) but janus logs aren't dumping to /logs dir any longer.

The above works in gremlin console.

Questions:

  1. how to get janus logs working?
  2. does v0.6 support GraphSONMessageSerializerV2d0 and scripts?
  3. where to post the javascript gremlin lib error described above?

Thanks! -Jim

re: logs, seems out-of-the-box, one must use -v to get logs to console & to file logs/janusgraph.log. Without -v, no log file is generated.

re: my issue w/v2do serialization. I'm using conf/gremlin-server/gremlin-server-cql-es.yaml which has serializers commented out by default. This uses v3 serialization, which isn't compatible with 2.0 from what I see (seems to have an extra map layer). I could change code to use it if necessary, but config claims one can just uncomment the other serializers to use the previous versions which I did: GraphSONMessageSerializerV20.

When I do the above I see gremlin server logs at init time claiming to by pass the use of 2.0 serialization since 3.0 is enabled by default. In those logs, when my service makes calls my fluent gremlin calls come through w/ "application/vnd.gremlin-v2.0+json" set, but the script one mentioned above comes through with application/vnd.gremlin-v3.0+json. I can give exact logs if you'd like.

-jim