Re: Why is rexindexing for a new index that is restricted to a new vertex label required?


Florian Hockmann <f...@...>
 

I created #1190 for this as it is still unclear why reindexing is necessary in this case.

Am Donnerstag, 5. Juli 2018 12:05:13 UTC+2 schrieb Florian Hockmann:

If the indexed keys or labels already existed prior to index construction it is necessary to reindex the entire graph in order to ensure that the index contains previously added elements.

However, I'm wondering why this requirement also applies to cases where the index has a vertex label restriction and where the vertex label was added in the same transaction. This listing illustrates what I mean:

// create new index for new label with existing property key
mgmt
= graph.openManagement()
existingPropertyKey
= mgmt.getPropertyKey('alreadyExistingProperty')
newVertexLabel
= mgmt.makeVertexLabel('newLabel').make()
idx
= mgmt.buildIndex('someIndex', Vertex.class).addKey(existingPropertyKey).indexOnly(newVertexLabel).buildCompositeIndex()
mgmt
.commit()

// check the index status
mgmt
= graph.openManagement()
existingPropertyKey
= mgmt.getPropertyKey('alreadyExistingProperty')
mgmt
.getGraphIndex('someIndex').getIndexStatus(existingPropertyKey )
// returned status is REGISTERED

Since the vertex label didn't exist prior to the transaction that also created the index it is clear that there can't be any data in the graph that needs to be reindexed. So, I expected the index to be immediately ENABLED and not require a manual reindex operation.

Does anyone know why it works that way? Are there maybe any restrictions that make it impossible to use the vertex label restriction to avoid the reindex requirement?

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