JanusGraphIndex how to retrieve constraint (indexOnly) specified for the global index?
Global indexes can be limited to the "constraint" by indexOnly() step, from JanusGraph documentation:
mgmt.buildIndex('byNameAndLabel', Vertex.class).addKey(name).indexOnly(god).buildCompositeIndex()
It is handled by the "createCompositeIndex(...) java code by:
addSchemaEdge(indexVertex, (JanusGraphSchemaVertex) constraint, TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT, null);
I should learn how the index was created from JanusGraphIndex instance, but the method is not there,... I need to have it automatically detected by the software somehow.
Is any other way to know it was Indexed Only By the "god"?
https://github.com/JanusGraph/janusgraph/issues/1163
Unless someone comes up with a solution, it seems you will have to keep track of label constraints yourself.
Best wishes, Marc
Thank you, Index class is having tx() transaction description, but I have not found it there as well,
I have added these comments to 1163 as suggested.
Regards, CM
Best wishes, Marc
JanusGraphSchemaType constraint = ManagementSystem.getGraphIndexDirect("indexName", ((ManagementSystem) mgmt).getWrappedTx()).getSchemaTypeConstraint();
On Feb 25, 2021, at 2:43 PM, hadoopmarc@... wrote:Thanks. Still, my earlier answer remains unsatisfactory. Somehow, a new JanusGraph instance must be able to load an existing schema from the system table and have the information about label constraints available. Otherwise, the instance would not be able to index newly added vertices and edges correctly.
Best wishes, Marc