orientechnologies / orientdb-gremlin

TinkerPop3 Graph Structure Implementation for OrientDB
Apache License 2.0
93 stars 32 forks source link

Invalid results (missing vertices) with multi-field index #126

Open christinedraper opened 7 years ago

christinedraper commented 7 years ago

I am creating a class and index as follows:

create class V_Entity extends V;
create property V_Entity.entityId STRING;
create property V_Entity.entityType STRING;
create index entity_index ON V_Entity (entityId, entityType) UNIQUE;

Then using the 3.2.3 driver via Gremlin console (connecting to 2.2.17 OrientDB server), I do:

t.addV("Entity").property("entityId", "entity1").property("entityType", "blah")

Doing any of:

t.V().hasLabel("Entity").has("entityId", "entity1")
t.V().has("entityType", "blah")
.V().hasLabel("Entity").has("entityId", "entity1").has("entityType", "blah")

returns the vertex, however:

t.V().hasLabel("Entity").has("entityType", "blah")
t.V().hasLabel("Entity").has("entityType", "blah").has("entityId", "entity1")

does not.

Worse, when running in Java I am getting duplicate record problems, which I think is because the code is not finding the existing vertex due to the above, and is then trying to create rather than update it.

I have discovered that adding an additional index:

create index type_index ON V_Entity (entityType) NOTUNIQUE;

appears to work around the problem, although I'd feel better if I understood why.

wolf4ood commented 7 years ago

Hi @calebbriggs

thanks for this issue. Let me try to reproduce it

Thanks