Re: Mixed index is not used by Gremlin query


simone...@...
 

I have just noticed that the key title for the index is not ENABLED 

mgmt = graph.openManagement()
mgmt
.getGraphIndex("titleAttributeSearch").getIndexStatus(mgmt.getGraphIndex("titleAttributeSearch").getFieldKeys()[0])
==>INSTALLED

how can I enable it?


Il giorno giovedì 28 settembre 2017 15:24:09 UTC+2, sim...@... ha scritto:
Following the Janus documentation, I defined a mixed index on my graph

mgmt = graph.openManagement()
attribute
= mgmt.getPropertyKey("title")
mgmt
.buildIndex("titleAttributeSearch", Vertex.class).addKey(attribute, Mapping.TEXTSTRING.asParameter()).buildMixedIndex("search")
mgmt
.commit()

After indexes definition, I ingested data, now the graph contains 120181 nodes.
Executing a direct index query searching for a string that should not return results the response is immediate

:> graph.indexQuery("titleAttributeSearch", "v.title:(sghjhgfds)").vertices()
2017-09-28 13:13:06,211 [gremlin-server-exec-36] INFO  org.janusgraph.graphdb.database.IndexSerializer  - Converted query string with 1 replacements: [v.title:(sghjhgfds)] => [title:(sghjhgfds)]

When I try to use a Gremlin query, the response requires many seconds and log reports that I'm not using indexes

:> g.V().has('title', Text.textContainsPrefix('sghjhgfds'))
2017-09-28 13:13:55,813 [gremlin-server-exec-8] WARN  org.janusgraph.graphdb.transaction.StandardJanusGraphTx  - Query requires iterating over all vertices [(title CONTAINS_PREFIX sghjhgfds)]. For better performance, use indexes

Am I doing some error?

Before the mixed index definition I set up a property index for versioning management

mgmt = graph.openManagement()
mgmt
.makePropertyKey("title").dataType(String.class).cardinality(LIST).make()
attribute
= mgmt.getPropertyKey("title")
mgmt
.buildPropertyIndex(attribute, "titleAttributeByVersion", mgmt.getPropertyKey("from"));
mgmt
.commit()

Join {janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.