Re: Mixed index is not used by Gremlin query


Robert Dale <rob...@...>
 


Since you have data and the index wasn't enabled, you'll need to reindex.  This will also move the index into enabled when complete.

mgmt = graph.openManagement()
mgmt.updateIndex(mgmt.getGraphIndex("titleAttributeSearch"), SchemaAction.REINDEX).get()
mgmt.commit()


Robert Dale

On Thu, Sep 28, 2017 at 12:16 PM, <simone...@...> wrote:
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()

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/b4bd9346-9dcd-4315-bcbf-efa67015b2b0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

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