use of com.baidu.hugegraph.structure.schema.IndexLabel in project incubator-hugegraph-toolchain by apache.
the class IndexLabelApiTest method testCreateSearchIndexOnMultiProperties.
@Test
public void testCreateSearchIndexOnMultiProperties() {
IndexLabel indexLabel = schema().indexLabel("personByAgeAndCity").onV("person").by("age", "city").search().build();
Utils.assertResponseError(400, () -> {
indexLabelAPI.create(indexLabel);
});
}
use of com.baidu.hugegraph.structure.schema.IndexLabel in project incubator-hugegraph-toolchain by apache.
the class IndexLabelApiTest method testListByNames.
@Test
public void testListByNames() {
IndexLabel personByAge = fillIndexLabel.apply("personByAge");
personByAge = indexLabelAPI.create(personByAge).indexLabel();
IndexLabel personByCity = schema().indexLabel("personByCity").onV("person").by("city").secondary().build();
personByCity = indexLabelAPI.create(personByCity).indexLabel();
List<IndexLabel> indexLabels;
indexLabels = indexLabelAPI.list(ImmutableList.of("personByAge"));
Assert.assertEquals(1, indexLabels.size());
assertContains(indexLabels, personByAge);
indexLabels = indexLabelAPI.list(ImmutableList.of("personByCity"));
Assert.assertEquals(1, indexLabels.size());
assertContains(indexLabels, personByCity);
indexLabels = indexLabelAPI.list(ImmutableList.of("personByAge", "personByCity"));
Assert.assertEquals(2, indexLabels.size());
assertContains(indexLabels, personByAge);
assertContains(indexLabels, personByCity);
}
use of com.baidu.hugegraph.structure.schema.IndexLabel in project incubator-hugegraph-toolchain by apache.
the class IndexLabelApiTest method testCreateOnUndefinedSchemaLabel.
@Test
public void testCreateOnUndefinedSchemaLabel() {
IndexLabel indexLabel1 = schema().indexLabel("authorByAge").onV("author").by("age").range().build();
Utils.assertResponseError(400, () -> {
indexLabelAPI.create(indexLabel1);
});
IndexLabel indexLabel2 = schema().indexLabel("writeByDate").onE("write").by("date").secondary().build();
Utils.assertResponseError(400, () -> {
indexLabelAPI.create(indexLabel2);
});
}
use of com.baidu.hugegraph.structure.schema.IndexLabel in project incubator-hugegraph-toolchain by apache.
the class TaskApiTest method testGet.
@Test
public void testGet() {
IndexLabel personByCity = schema().getIndexLabel("personByCity");
long taskId = rebuildAPI.rebuild(personByCity);
Task task = taskAPI.get(taskId);
Assert.assertNotNull(task);
Assert.assertEquals(taskId, task.id());
waitUntilTaskCompleted(taskId);
}
use of com.baidu.hugegraph.structure.schema.IndexLabel in project incubator-hugegraph-toolchain by apache.
the class TaskApiTest method testDelete.
@Test
public void testDelete() {
IndexLabel personByCity = schema().getIndexLabel("personByCity");
long taskId = rebuildAPI.rebuild(personByCity);
waitUntilTaskCompleted(taskId);
taskAPI.delete(taskId);
Utils.assertResponseError(404, () -> {
taskAPI.get(taskId);
});
}
Aggregations