if (parameters==null) parameters=new Parameter[0]; IndexType indexType = ((TitanGraphIndexWrapper)index).getBaseIndex(); Preconditions.checkArgument(indexType instanceof MixedIndexType,"Can only add keys to an external index, not %s",index.getName()); Preconditions.checkArgument(indexType instanceof IndexTypeWrapper && key instanceof TitanSchemaVertex && ((IndexTypeWrapper)indexType).getSchemaBase() instanceof TitanSchemaVertex); Preconditions.checkArgument(!field.getFieldKey().equals(key),"Key [%s] has already been added to index %s",key.getName(),index.getName());
TitanGraphIndex mixed = mgmt.buildIndex("mixed", Vertex.class).addKey(weight) .addKey(text, getTextMapping()).buildMixedIndex(INDEX); mixed.getName(); composite.getName(); finishSchema(); numV/strs.length,new boolean[]{false,true}); evaluateQuery(tx.query().has(text,Text.CONTAINS,strs[0]),ElementCategory.VERTEX, numV/strs.length,new boolean[]{true,true},mixed.getName()); evaluateQuery(tx.query().has(text,Text.CONTAINS,strs[0]).has(flag.getName()),ElementCategory.VERTEX, numV/strs.length,new boolean[]{false,true},mixed.getName()); evaluateQuery(tx.query().has(name, Cmp.EQUAL, strs[0]).has(weight, Cmp.EQUAL, 1.5), ElementCategory.VERTEX, numV / divisor, new boolean[]{true, true}, composite.getName()); evaluateQuery(tx.query().has(name,Cmp.EQUAL,strs[0]).has(weight,Cmp.EQUAL,1.5).has(flag.getName()),ElementCategory.VERTEX, numV/divisor,new boolean[]{false,true},composite.getName()); evaluateQuery(tx.query().has(text, Text.CONTAINS, strs[2]).has(weight, Cmp.EQUAL, 2.5), ElementCategory.VERTEX, numV / divisor, new boolean[]{true, true}, mixed.getName()); evaluateQuery(tx.query().has(text,Text.CONTAINS,strs[2]).has(weight,Cmp.EQUAL,2.5).has(flag.getName()),ElementCategory.VERTEX, numV/divisor,new boolean[]{false,true},mixed.getName()); evaluateQuery(tx.query().has(text, Text.CONTAINS, strs[3]).has(name,Cmp.EQUAL,strs[3]).has(weight,Cmp.EQUAL,3.5),ElementCategory.VERTEX, numV/divisor,new boolean[]{true,true},mixed.getName(),composite.getName()); evaluateQuery(tx.query().has(text, Text.CONTAINS, strs[3]).has(name,Cmp.EQUAL,strs[3]).has(weight,Cmp.EQUAL,3.5).has(flag.getName()),ElementCategory.VERTEX, numV/divisor,new boolean[]{false,true},mixed.getName(),composite.getName()); numV / strs.length, new boolean[]{false, true}); evaluateQuery(tx.query().has(text,Text.CONTAINS,strs[0]),ElementCategory.VERTEX, numV/strs.length,new boolean[]{true,true},mixed.getName()); evaluateQuery(tx.query().has(text, Text.CONTAINS, strs[0]).has(flag.getName()), ElementCategory.VERTEX, numV / strs.length, new boolean[]{false, true}, mixed.getName()); evaluateQuery(tx.query().has(name,Cmp.EQUAL,strs[0]).has(weight,Cmp.EQUAL,1.5),ElementCategory.VERTEX,
assertEquals("prop1",prop1.getName()); assertTrue(Vertex.class.isAssignableFrom(vertex3.getIndexedElement())); assertTrue(TitanProperty.class.isAssignableFrom(prop1.getIndexedElement())); assertEquals("prop1",prop1.getName()); assertTrue(Vertex.class.isAssignableFrom(vertex3.getIndexedElement())); assertTrue(TitanProperty.class.isAssignableFrom(prop1.getIndexedElement())); ElementCategory.EDGE,1,new boolean[]{true,sorted},edge1.getName()); evaluateQuery(tx.query().has(time,Contain.IN,ImmutableList.of(10,20,30)).has(weight,Cmp.EQUAL,0), ElementCategory.EDGE,3,new boolean[]{true,sorted},edge1.getName()); evaluateQuery(tx.query().has(time,Cmp.EQUAL,10).has(weight,Cmp.EQUAL,0).has(text,Cmp.EQUAL,strs[10%strs.length]), ElementCategory.EDGE,1,new boolean[]{false,sorted},edge1.getName()); evaluateQuery(tx.query().has(time,Cmp.EQUAL,10).has(weight,Cmp.EQUAL,1), ElementCategory.EDGE,1,new boolean[]{true,sorted},edge1.getName()); evaluateQuery(tx.query().has(time,Cmp.EQUAL,20).has(weight,Cmp.EQUAL,0), ElementCategory.EDGE,1,new boolean[]{true,sorted},edge1.getName()); evaluateQuery(tx.query().has(time,Cmp.EQUAL,20).has(weight,Cmp.EQUAL,3), ElementCategory.EDGE,0,new boolean[]{true,sorted},edge1.getName()); evaluateQuery(tx.query().has(text,Cmp.EQUAL,strs[0]).has("label",connect.getName()), ElementCategory.EDGE,numV/strs.length,new boolean[]{true,sorted},edge2.getName()); evaluateQuery(tx.query().has(text,Cmp.EQUAL,strs[0]).has("label",connect.getName()).limit(10), ElementCategory.EDGE,10,new boolean[]{true,sorted},edge2.getName()); evaluateQuery(tx.query().has(text,Cmp.EQUAL,strs[0]), ElementCategory.EDGE,numV/strs.length*2,new boolean[]{false,sorted}); ElementCategory.PROPERTY,2,new boolean[]{true,sorted},prop1.getName()); evaluateQuery(tx.query().has(weight,Cmp.EQUAL,0.0).has(text,Cmp.EQUAL,strs[0]), ElementCategory.PROPERTY,2*numV/(4*5),new boolean[]{true,sorted},prop2.getName());
assertEquals("index2",index2.getName()); assertEquals(INDEX,index3.getBackingIndex()); assertFalse(index2.isUnique()); assertEquals("index2",index2.getName()); assertEquals(INDEX,index3.getBackingIndex()); assertFalse(index2.isUnique()); numV/strs.length,new boolean[]{true,true},index2.getName()); evaluateQuery(tx.query().has(text,Text.CONTAINS,strs[0]).has("label",Cmp.EQUAL,person.getName()).orderBy(weight,Order.DESC),ElementCategory.VERTEX, numV/strs.length,new boolean[]{true,true},weight,Order.DESC,index2.getName()); evaluateQuery(tx.query().has(text,Text.CONTAINS,strs[3]).has("label",Cmp.EQUAL,org.getName()),ElementCategory.VERTEX, numV/strs.length,new boolean[]{true,true},index3.getName()); evaluateQuery(tx.query().has(text,Text.CONTAINS,strs[1]).has("label",Cmp.EQUAL,org.getName()).orderBy(weight,Order.DESC),ElementCategory.VERTEX, numV/strs.length,new boolean[]{true,true},weight,Order.DESC,index3.getName()); evaluateQuery(tx.query().has(text,Text.CONTAINS,strs[0]).has(weight,Cmp.EQUAL,2.5).has("label",Cmp.EQUAL,person.getName()),ElementCategory.VERTEX, numV/(modulo*strs.length),new boolean[]{true,true},index2.getName()); evaluateQuery(tx.query().has(name,Cmp.EQUAL,strs[2]).has("label",Cmp.EQUAL,person.getName()),ElementCategory.VERTEX, numV/strs.length,new boolean[]{false,true},index1.getName()); evaluateQuery(tx.query().has(name,Cmp.EQUAL,strs[3]).has("label",Cmp.EQUAL,person.getName()),ElementCategory.VERTEX, 0,new boolean[]{false,true},index1.getName()); evaluateQuery(tx.query().has(name,Cmp.EQUAL,strs[0]),ElementCategory.VERTEX, numV/strs.length,new boolean[]{true,true},index1.getName()); evaluateQuery(tx.query().has(name,Cmp.EQUAL,strs[2]).has(text,Text.CONTAINS,strs[2]).has("label",Cmp.EQUAL,person.getName()),ElementCategory.VERTEX, numV/strs.length,new boolean[]{true,true},index1.getName(),index2.getName()); evaluateQuery(tx.query().has(name,Cmp.EQUAL,strs[0]).has(text,Text.CONTAINS,strs[0]).has("label",Cmp.EQUAL,person.getName()).orderBy(weight,Order.ASC),ElementCategory.VERTEX, numV/strs.length,new boolean[]{true,true},weight,Order.ASC,index1.getName(),index2.getName()); numV/strs.length,new boolean[]{true,true},index2.getName());
mixed.getName(); finishSchema();
TitanGraphIndex gindex = mgmt.getGraphIndex("timeIndex"); mgmt.changeName(gindex,"byTime"); assertEquals("byTime",gindex.getName());